Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <div id="app">
  <svg width="470px" height="373px" viewBox="0 0 470 373" version="1.1" xmlns="" xmlns:xlink="">
    <g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <rect id="1" fill="#FF0303" fill-rule="nonzero" x="58" y="10" width="50" height="50"></rect>
        <rect id="2" fill="#FF0303" fill-rule="nonzero" x="134" y="10" width="50" height="50"></rect>
        <rect id="3" fill="#FF0303" fill-rule="nonzero" x="210" y="10" width="50" height="50"></rect>
        <rect id="4" fill="#FF0303" fill-rule="nonzero" x="286" y="10" width="50" height="50"></rect>
        <rect id="5" fill="#FF0303" fill-rule="nonzero" x="362" y="10" width="50" height="50"></rect>
        <rect id="6" fill="#FF0303" fill-rule="nonzero" x="58" y="86" width="50" height="50"></rect>
        <rect id="7" fill="#FF0303" fill-rule="nonzero" x="134" y="86" width="50" height="50"></rect>
        <rect id="8" fill="#FF0303" fill-rule="nonzero" x="210" y="86" width="50" height="50"></rect>
        <rect id="9" fill="#FF0303" fill-rule="nonzero" x="286" y="86" width="50" height="50"></rect>
        <rect id="10" fill="#FF0303" fill-rule="nonzero" x="362" y="86" width="50" height="50"></rect>
        <rect id="11" fill="#FF0303" fill-rule="nonzero" x="58" y="162" width="50" height="50"></rect>
        <rect id="12" fill="#FF0303" fill-rule="nonzero" x="134" y="162" width="50" height="50"></rect>
        <rect id="13" fill="#FF0303" fill-rule="nonzero" x="210" y="162" width="50" height="50"></rect>
        <rect id="14" fill="#FF0303" fill-rule="nonzero" x="286" y="162" width="50" height="50"></rect>
        <rect id="15" fill="#FF0303" fill-rule="nonzero" x="362" y="162" width="50" height="50"></rect>
        <rect id="16" fill="#FF0303" fill-rule="nonzero" x="58" y="238" width="50" height="50"></rect>
        <rect id="17" fill="#FF0303" fill-rule="nonzero" x="134" y="238" width="50" height="50"></rect>
        <rect id="18" fill="#FF0303" fill-rule="nonzero" x="210" y="238" width="50" height="50"></rect>
        <rect id="19" fill="#FF0303" fill-rule="nonzero" x="286" y="238" width="50" height="50"></rect>
        <rect id="20" fill="#FF0303" fill-rule="nonzero" x="362" y="238" width="50" height="50"></rect>
        <rect id="21" fill="#FF0303" fill-rule="nonzero" x="58" y="314" width="50" height="50"></rect>
        <rect id="22" fill="#FF0303" fill-rule="nonzero" x="134" y="314" width="50" height="50"></rect>
        <rect id="23" fill="#FF0303" fill-rule="nonzero" x="210" y="314" width="50" height="50"></rect>
        <rect id="24" fill="#FF0303" fill-rule="nonzero" x="286" y="314" width="50" height="50"></rect>
        <rect id="25" fill="#FF0303" fill-rule="nonzero" x="362" y="314" width="50" height="50"></rect>





                new Vue({
  el: "#app",

  data() {
    return {
      minDelay: 0.3,
      maxDelay: 6, // 6 seconds
      timelines: [],
      // numberOfTransactions: 5 // this does not need to be reactive, does it?
  methods: {
      randomIntervalTime() {
      const maxTime = this.maxDelay;
      const minTime = this.minDelay;
      const randomTime = (
        Math.random() * (maxTime - minTime) +
      return randomTime;
    randomiseLocations() {
        We already have allItems stored,
        no need to traverse the DOM all the time.
      // return document.getElementById(
      //   Math.floor(Math.random() * Math.floor(25))
      // );
      let index = Math.floor(Math.random() * Math.floor(this.allItems.length));
      let trg = this.allItems[index];
      if(TweenMax.isTweening(trg)) {
        console.log('it is tweening, check again', index);
        return this.randomiseLocations();
      } else {
        console.log('not tweening', index);
        return trg;
    tweenItem() {
      // console.count('setup tweenItem');
        What you need to pay attention to is whether you are trying to animate a target that's already animating.
        From what I see in your setup here, you do not want to override an already
        tweening element, it can cause the box to not end up back on its original colour
      const vm = this;
      TweenMax.delayedCall(this.randomIntervalTime(), function() {  
        // Having your delay inside the tween was problematic and was leading to false negatives when checking to see if the object had a tween attached to it.
        let randomTrg = vm.randomiseLocations();
          1, {
            repeat: 1,
            yoyo: true,
            fill: "#7897D3",
            onStart: function() {
              console.log('start tweenItem', Number( - 1);
            onComplete: function() {
              console.log('completed', Number( - 1);
            scale: 0.5,
            transformOrigin: 'center center'

  mounted() {
    // you can count how many children in your "board" programatically, rather than have it as a data() attribute
    this.allItems = this.$el.querySelectorAll('rect');
    this.numberOfTransactions = 5;
    for (let i = 0; i < this.numberOfTransactions; i++) {
  beforeDestroy() {
    // stop any tweens that might be playing
    for(let i = 0; i < this.allItems.length; i++) {
      const target = this.allItems[i];