Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="board" viewBox="0 0 320 460" width="100%" height="100%" preserveAspectRatio="xMidYMax meet">
  <defs>
    <polygon id="rock" points="0,0 0,32 32,32 32,0" stroke-width="0" fill="#444" />
    <svg id="ball1" width="32" height="32" xmlns="http://www.w3.org/2000/svg" class="ball">
      <circle class="ball1" stroke-width="1" cx="16" cy="16" r="15" />
      <text x="16" y="21">1</text>
    </svg>
    <svg id="ball2" width="32" height="32" xmlns="http://www.w3.org/2000/svg" class="ball">
      <circle class="ball2" stroke-width="1" cx="16" cy="16" r="15" />
      <text x="16" y="21">2</text>
    </svg>
    <svg id="ball3" width="32" height="32" xmlns="http://www.w3.org/2000/svg" class="ball">
      <circle class="ball3" stroke-width="1" cx="16" cy="16" r="15" />
      <text x="16" y="21">3</text>
    </svg>
    <svg id="ball4" width="32" height="32" xmlns="http://www.w3.org/2000/svg" class="ball">
      <circle class="ball4" stroke-width="1" cx="16" cy="16" r="15" />
      <text x="16" y="21">4</text>
    </svg>
    <svg id="ball5" width="32" height="32" xmlns="http://www.w3.org/2000/svg" class="ball">
      <circle class="ball5" stroke-width="1" cx="16" cy="16" r="15" />
      <text x="16" y="21">5</text>
    </svg>
    <svg id="ball6" width="32" height="32" xmlns="http://www.w3.org/2000/svg" class="ball">
      <circle class="ball6" stroke-width="1" cx="16" cy="16" r="15" />
      <text x="16" y="21">6</text>
    </svg>
  </defs>

  <g id="tutorial" opacity="0">
    <polygon class="playzone" points="-1,461 -1,204 32,204 32,170 64,170 64,138 96,138 96,106 128,106 128,74 160,74 160,42 321,42 321,461" style="stroke-width: 0; fill: #777;" />

    <text class="title" x="320" y="30"><a xlink:href="http://esviji.com/" xlink:show="new">esviji.com</a></text>
    <text class="scoreLabel" x="65" y="25">score:</text>
    <text id="score1" class="score" x="75" y="25">0</text>
    <text id="score2" class="score" x="75" y="25" opacity="0">9</text>
    <text class="levelLabel" x="65" y="50">level:</text>
    <text class="level" x="75" y="50">1</text>
    <text class="livesLabel" x="65" y="75">lives:</text>
    <text class="lives" x="75" y="75">9</text>

    <use id="tutoBall11" xlink:href="#ball2" x="0" y="428"/>
    <use id="tutoBall12" xlink:href="#ball5" x="0" y="396"/>
    <use id="tutoBall13" xlink:href="#ball1" x="0" y="364"/>
    <use id="tutoBall14" xlink:href="#ball2" x="0" y="332"/>
    <use id="tutoBall15" xlink:href="#ball2" x="0" y="300"/>
    <use id="tutoBall16" xlink:href="#ball1" x="0" y="268"/>
    <use id="tutoBall17" xlink:href="#ball4" x="0" y="236"/>
    <use id="tutoBall21" xlink:href="#ball4" x="32" y="428"/>
    <use id="tutoBall22" xlink:href="#ball6" x="32" y="396"/>
    <use id="tutoBall23" xlink:href="#ball3" x="32" y="364"/>
    <use id="tutoBall24" xlink:href="#ball5" x="32" y="332"/>
    <use id="tutoBall25" xlink:href="#ball3" x="32" y="300"/>
    <use id="tutoBall26" xlink:href="#ball5" x="32" y="268"/>
    <use id="tutoBall27" xlink:href="#ball4" x="32" y="236"/>
    <use id="tutoBall31" xlink:href="#ball5" x="64" y="428"/>
    <use id="tutoBall32" xlink:href="#ball2" x="64" y="396"/>
    <use id="tutoBall33" xlink:href="#ball2" x="64" y="364"/>
    <use id="tutoBall34" xlink:href="#ball6" x="64" y="332"/>
    <use id="tutoBall35" xlink:href="#ball2" x="64" y="300"/>
    <use id="tutoBall36" xlink:href="#ball4" x="64" y="268"/>
    <use id="tutoBall37" xlink:href="#ball5" x="64" y="236"/>
    <use id="tutoBall41" xlink:href="#ball5" x="96" y="428"/>
    <use id="tutoBall42" xlink:href="#ball5" x="96" y="396"/>
    <use id="tutoBall43" xlink:href="#ball4" x="96" y="364" />
    <use id="tutoBall43Morph" xlink:href="#ball2" x="96" y="364" opacity="0" />
    <use id="tutoBall44" xlink:href="#ball1" x="96" y="332" />
    <use id="tutoBall45" xlink:href="#ball4" x="96" y="300" />
    <use id="tutoBall46" xlink:href="#ball3" x="96" y="268" />
    <use id="tutoBall47" xlink:href="#ball1" x="96" y="236" />
    <use id="tutoBall51" xlink:href="#ball2" x="128" y="428"/>
    <use id="tutoBall52" xlink:href="#rock" x="128" y="396"/>
    <use id="tutoBall53" xlink:href="#ball4" x="128" y="364" />
    <use id="tutoBall54" xlink:href="#ball4" x="128" y="332" />
    <use id="tutoBall55" xlink:href="#ball3" x="128" y="300" />
    <use id="tutoBall56" xlink:href="#ball2" x="128" y="268" />
    <use id="tutoBall57" xlink:href="#ball3" x="128" y="236" />
    <use id="tutoBall61" xlink:href="#ball2" x="160" y="428"/>
    <use id="tutoBall62" xlink:href="#ball1" x="160" y="396"/>
    <use id="tutoBall63" xlink:href="#ball4" x="160" y="364" />
    <use id="tutoBall64" xlink:href="#ball2" x="160" y="332" />
    <use id="tutoBall65" xlink:href="#ball5" x="160" y="300" />
    <use id="tutoBall66" xlink:href="#ball2" x="160" y="268" />
    <use id="tutoBall67" xlink:href="#ball2" x="160" y="236" />

    <use id="tutoPlayable" xlink:href="#ball4" x="288" y="204" />
    <use id="tutoPlayable2" xlink:href="#ball2" x="288" y="204" opacity="0" />

    <g id="tutoBallsText" class="step" opacity="0">
      <rect x="50" y="100" width="250" height="90" />
      <text>
        <tspan x="70" y="130">These are the balls you</tspan>
        <tspan x="70" y="150">have to destroy to finish</tspan>
        <tspan x="70" y="170">the turn.</tspan>
      </text>
      <path d="M 70 190 L 100 190 L 70 220 z" />
    </g>
    <g id="tutoPlayableText" class="step" opacity="0">
      <rect x="20" y="140" width="230" height="110" />
      <path d="M 250 220 L 250 190 L 280 220 z" />
      <text>
        <tspan x="40" y="170">This is the ball you</tspan>
        <tspan x="40" y="190">can move up or down</tspan>
        <tspan x="40" y="210">and then release to</tspan>
        <tspan x="40" y="230">destroy the others.</tspan>
      </text>
    </g>
    <g id="tutoPlayText" class="step" opacity="0">
      <rect x="20" y="140" width="230" height="110" />
      <text>
        <tspan x="40" y="170">You can use your</tspan>
        <tspan x="40" y="190">mouse, finger or</tspan>
        <tspan x="40" y="210">keyboard to move the</tspan>
        <tspan x="40" y="230">ball.</tspan>
      </text>
    </g>
    <g id="tutoMoveText" class="step" opacity="0">
      <rect x="20" y="140" width="230" height="110" />
      <text>
        <tspan x="40" y="170">The ball then goes to</tspan>
        <tspan x="40" y="190">the left until it hits</tspan>
        <tspan x="40" y="210">something: ball,</tspan>
        <tspan x="40" y="230">rock or wall.</tspan>
      </text>
    </g>
    <g id="tutoHitText" class="step" opacity="0">
      <rect x="20" y="140" width="230" height="110" />
      <text>
        <tspan x="40" y="170">You have to hit same</tspan>
        <tspan x="40" y="190">balls to destroy them.</tspan>
        <tspan x="40" y="210">Hit more balls to</tspan>
        <tspan x="40" y="230">gain more points.</tspan>
      </text>
    </g>
    <g id="tutoMorphText" class="step" opacity="0">
      <rect x="20" y="140" width="230" height="110" />
      <text>
        <tspan x="40" y="170">The ball morphes</tspan>
        <tspan x="40" y="190">into the next ball it</tspan>
        <tspan x="40" y="210">hits, becoming the</tspan>
        <tspan x="40" y="230">new playable ball.</tspan>
      </text>
    </g>
    <g id="tutoFallText" class="step" opacity="0">
      <rect x="20" y="140" width="230" height="90" />
      <text>
        <tspan x="40" y="170">Balls that now have</tspan>
        <tspan x="40" y="190">holes under them</tspan>
        <tspan x="40" y="210">fall.</tspan>
      </text>
    </g>
    <g id="tutoScoreText" class="step" opacity="0">
      <rect x="20" y="140" width="230" height="90" />
      <text>
        <tspan x="40" y="170">Score is increased</tspan>
        <tspan x="40" y="190">with (# hit balls)^3</tspan>
      </text>
    </g>
    <g id="tutoPlayOnlineText" class="step" opacity="0">
      <rect x="20" y="140" width="280" height="90" />
      <text>
        <tspan x="40" y="170">Play online now on</tspan>
        <tspan x="40" y="210"><a xlink:href="http://play.esviji.com/" xlink:show="new">http://play.esviji.com/</a></tspan>
      </text>
    </g>
    <animate id="tutoAnimStart" attributeType="xml" attributeName="opacity" to="1" begin="0" dur="2s" fill="freeze" />

    <animate id="tutoBallsAnimStart" xlink:href="#tutoBallsText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoAnimStart.end" dur="2s" fill="freeze" />
    <animate id="tutoBallsAnimEnd" xlink:href="#tutoBallsText" attributeType="xml" attributeName="opacity" to="0" begin="tutoBallsAnimStart.end+2s" dur="2s" fill="freeze" />

    <animate id="tutoPlayableAnimStart" xlink:href="#tutoPlayableText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoBallsAnimEnd.end" dur="2s" fill="freeze" />
    <animate id="tutoPlayableMove1" xlink:href="#tutoPlayable" attributeType="xml" attributeName="y" to="428" begin="tutoPlayableAnimStart.end+2s" dur="1.5s" fill="freeze" />
    <animate id="tutoPlayableMove2" xlink:href="#tutoPlayable" attributeType="xml" attributeName="y" to="44" begin="tutoPlayableMove1.end" dur="3s" fill="freeze" />
    <animate id="tutoPlayableMove3" xlink:href="#tutoPlayable" attributeType="xml" attributeName="y" to="364" begin="tutoPlayableMove2.end" dur="2s" fill="freeze" />
    <animate id="tutoPlayableAnimEnd" xlink:href="#tutoPlayableText" attributeType="xml" attributeName="opacity" to="0" begin="tutoPlayableAnimStart.end+2s" dur="2s" fill="freeze" />
    <animate id="tutoPlayAnimStart" xlink:href="#tutoPlayText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoPlayableAnimEnd.end" dur="4s" fill="freeze" />
    <animate id="tutoPlayAnimEnd" xlink:href="#tutoPlayText" attributeType="xml" attributeName="opacity" to="0" begin="tutoPlayAnimStart.end" dur="2s" fill="freeze" />

    <animate id="tutoMoveAnimStart" xlink:href="#tutoMoveText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoPlayAnimEnd.end" dur="4s" fill="freeze" />
    <animate id="tutoPlayableMove4" xlink:href="#tutoPlayable" attributeType="xml" attributeName="x" to="192" begin="tutoMoveAnimStart.end" dur="1.5s" fill="freeze" />
    <animate id="tutoMoveAnimEnd" xlink:href="#tutoMoveText" attributeType="xml" attributeName="opacity" to="0" begin="tutoPlayableMove4.end" dur="2s" fill="freeze" />

    <animate id="tutoHitAnimStart" xlink:href="#tutoHitText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoPlayableMove4.end" dur="4s" fill="freeze" />
    <animate id="tutoHitBall1" xlink:href="#tutoBall63" attributeType="xml" attributeName="opacity" to="0" begin="tutoPlayableMove4.end" dur="0.8s" fill="freeze" />
    <animateTransform id="tutoHitBall2" xlink:href="#tutoBall63" attributeType="xml" attributeName="transform" type="rotate" from="0 176 380" to="360 176 380" begin="tutoPlayableMove4.end" dur="0.8s" />
    <animate id="tutoPlayableHit1" xlink:href="#tutoPlayable" attributeType="xml" attributeName="x" to="160" begin="tutoPlayableMove4.end" dur="0.8s" fill="freeze" />
    <animate id="tutoHitBall3" xlink:href="#tutoBall53" attributeType="xml" attributeName="opacity" to="0" begin="tutoPlayableHit1.end" dur="0.8s" fill="freeze" />
    <animateTransform id="tutoHitBall4" xlink:href="#tutoBall53" attributeType="xml" attributeName="transform" type="rotate" from="0 144 380" to="360 144 380" begin="tutoPlayableHit1.end" dur="0.8s" />
    <animate id="tutoPlayableHit2" xlink:href="#tutoPlayable" attributeType="xml" attributeName="x" to="128" begin="tutoPlayableHit1.end" dur="0.8s" fill="freeze" />
    <animate id="tutoHitBall5" xlink:href="#tutoBall43" attributeType="xml" attributeName="opacity" to="0" begin="tutoPlayableHit2.end" dur="0.8s" fill="freeze" />
    <animateTransform id="tutoHitBall6" xlink:href="#tutoBall43" attributeType="xml" attributeName="transform" type="rotate" from="0 112 380" to="360 112 380" begin="tutoPlayableHit2.end" dur="0.8s" />
    <animate id="tutoPlayableHit3" xlink:href="#tutoPlayable" attributeType="xml" attributeName="x" to="96" begin="tutoPlayableHit2.end" dur="0.8s" fill="freeze" />
    <animate id="tutoHitAnimEnd" xlink:href="#tutoHitText" attributeType="xml" attributeName="opacity" to="0" begin="tutoHitAnimStart.end" dur="2s" fill="freeze" />

    <animate id="tutoMorphAnimStart" xlink:href="#tutoMorphText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoHitAnimEnd.end" dur="4s" fill="freeze" />
    <animate id="tutoPlayableMorph1" xlink:href="#tutoPlayable" attributeType="xml" attributeName="opacity" to="0" begin="tutoMorphAnimStart.end" dur="2s" fill="freeze" />
    <animate id="tutoPlayableMorph2" xlink:href="#tutoPlayable" attributeType="xml" attributeName="x" to="64" begin="tutoMorphAnimStart.end" dur="2s" fill="freeze" />
    <animate id="tutoPlayableMorph3" xlink:href="#tutoBall43Morph" attributeType="xml" attributeName="opacity" to="1" begin="tutoMorphAnimStart.end" dur="2s" fill="freeze" />
    <animate id="tutoPlayableMorph4" xlink:href="#tutoBall43Morph" attributeType="xml" attributeName="x" to="64" begin="tutoMorphAnimStart.end" dur="2s" fill="freeze" />
    <animate id="tutoPlayableMorph5" xlink:href="#tutoPlayable2" attributeType="xml" attributeName="opacity" to="1" begin="tutoPlayableMorph2.end" dur="1s" fill="freeze" />
    <animate id="tutoMorphAnimEnd" xlink:href="#tutoMorphText" attributeType="xml" attributeName="opacity" to="0" begin="tutoPlayableMorph2.end" dur="2s" fill="freeze" />

    <animate id="tutoFallAnimStart" xlink:href="#tutoFallText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoMorphAnimEnd.end" dur="4s" fill="freeze" />
    <animate xlink:href="#tutoBall44" attributeType="xml" attributeName="y" to="364" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall45" attributeType="xml" attributeName="y" to="332" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall46" attributeType="xml" attributeName="y" to="300" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall47" attributeType="xml" attributeName="y" to="268" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall54" attributeType="xml" attributeName="y" to="364" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall55" attributeType="xml" attributeName="y" to="332" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall56" attributeType="xml" attributeName="y" to="300" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall57" attributeType="xml" attributeName="y" to="268" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall64" attributeType="xml" attributeName="y" to="364" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall65" attributeType="xml" attributeName="y" to="332" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall66" attributeType="xml" attributeName="y" to="300" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate xlink:href="#tutoBall67" attributeType="xml" attributeName="y" to="268" begin="tutoFallAnimStart.end" dur="0.8s" fill="freeze" />
    <animate id="tutoFallAnimEnd" xlink:href="#tutoFallText" attributeType="xml" attributeName="opacity" to="0" begin="tutoFallAnimStart.end" dur="2s" fill="freeze" />

    <animate id="tutoScoreAnimStart" xlink:href="#tutoScoreText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoFallAnimEnd.end" dur="2s" fill="freeze" />

    <animate xlink:href="#score1" attributeType="xml" attributeName="opacity" to="0" begin="tutoScoreAnimStart.start" dur="1s" fill="freeze" />
    <animate xlink:href="#score2" attributeType="xml" attributeName="opacity" to="1" begin="tutoScoreAnimStart.start" dur="1s" fill="freeze" />

    <animate id="tutoScoreAnimEnd" xlink:href="#tutoScoreText" attributeType="xml" attributeName="opacity" to="0" begin="tutoScoreAnimStart.end" dur="2s" fill="freeze" />

    <animate id="tutoPlayOnlineAnimStart" xlink:href="#tutoPlayOnlineText" attributeType="xml" attributeName="opacity" to=".9" begin="tutoScoreAnimEnd.end" dur="2s" fill="freeze" />

    <animate id="tutoAnimEnd" attributeType="xml" attributeName="opacity" to=".8" begin="tutoScoreAnimEnd.end" dur="3s" fill="freeze" />
  </g>
</svg>

              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Sansita+One);

html, body {
  font-family: 'Sansita One', cursive;
  font-size: 18px;
  /* http://maximilianhoffmann.com/posts/better-font-rendering-on-osx */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #444;
  color: #fff;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#board {
  stroke-width: 0;
}

#tutorial .title {
  font-size: 34px;
  text-anchor: end;
  fill: #fff;
  stroke-width: 0;
}
#tutorial .scoreLabel, #tutorial .levelLabel, #tutorial .livesLabel {
  text-anchor: end;
  fill: #ccc;
  stroke-width: 0;
}
#tutorial .score, #tutorial .level, #tutorial .lives {
  -webkit-transition: all 1s ease-out;
  transition: all 1s ease-out;
  fill: #eee;
  stroke-width: 0;
}
#tutorial .score.changeDown, #tutorial .level.changeDown, #tutorial .lives.changeDown {
  fill: #c0392b;
}
#tutorial .score.changeUp, #tutorial .level.changeUp, #tutorial .lives.changeUp {
  fill: #27ae60;
}

.ball text {
  font-size: 16px;
  text-anchor: middle;
  fill: #fff;
  stroke-width: 0;
}

.ball1 {
  fill: #f39c12;
  stroke: #e67e22;
}

.ball2 {
  fill: #2ecc71;
  stroke: #27ae60;
}

.ball3 {
  fill: #3498db;
  stroke: #2980b9;
}

.ball4 {
  fill: #9b59b6;
  stroke: #8e44ad;
}

.ball5 {
  fill: #aa8866;
  stroke: #776655;
}

.ball6 {
  fill: #e74c3c;
  stroke: #c0392b;
}

#playable {
  pointer-events: none;
}
#playable:hover {
  cursor: pointer;
}

.panelBackground {
  pointer-events: visible;
  fill: transparent;
}

.label {
  text-anchor: end;
  fill: #fff;
}

.copyright, .website, .version {
  font-size: 10px;
  fill: #888;
  stroke-width: 0;
}

.step text {
  font-weight: normal;
  fill: #333;
}
.step rect, .step path {
  fill: #aaa;
  fill-opacity: 1;
  stroke-width: 0;
  stroke: #aaa;
}

#tutoPlayOnlineText text {
  fill: #fff;
}
              
            
!

JS

              
                
              
            
!
999px

Console