css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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. 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

  padding: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;

              var background
var sprite
var figures
var curFraming; // updates every time the framing is changed
var spriteArray = [];
var objectArray = [];
var maskActive = false;
var curCast;
var fallingSprite;
var allGraphics;
// Background color

  at: 'back', // You can use 'back', 'mid' and 'fore'

  init: function(PIXI, input) {
    //  Draw you graphics in PIXI adding them to input.container
    background = new PIXI.Graphics();
    background.drawRect(0,0,input.width, input.height)
    /*var text 
    text = new PIXI.Text('SCARLET PLEASURE', {fontFamily : 'Arial Black', fontSize: 100, fill :input.colors[18], align : 'center'});



  render: function(PIXI, input) {
    //  This is called on every frame, put your animation here
    // Set random color when framing changes
    var thisFraming = input.editing ;
      curFraming = thisFraming
      randNum    = Math.floor( Math.random()*input.colors.length ) // Calculate random color between 0-numberOfAvailableColors
      randomCol  = input.colors[ randNum ] // Get random color from presets
      // Change the background's color
      background.drawRect(0,0,input.width, input.height)


// Foreground, Beginning reveal + rows in forground
  at: "fore",
  init: function(PIXI,input){
    //rows on top and bottom
    allGraphics = [input.graphics.crazyflower1, input.graphics.crazyflower2, input.graphics.crazyflower3, input.graphics.flower1, input.graphics.flower2, input.graphics.wingwave];
    var object;
    //distance between each object
    var distX = 40
    var distY = 40
    //for loop of objects
    var i = 0;
    while (distX * i < input.width){
      //object = new PIXI.Sprite(input.graphics.botanicorganic);
      var rand = Math.floor(Math.random()*allGraphics.length);
      object = new PIXI.Sprite(allGraphics[rand]);
      object.anchor.x = 0.5;
      object.anchor.y = 0.5;
      //where the object is placed
      if(i%2 == 0){
        object.position.x = distX*i;
        object.position.y = distY;
        object.position.x = (distX*(i-1));
        //distance between rows 
        object.position.y = input.height - distY;
      //how big it is
      object.scale.x = 0.2;
      object.scale.y = 0.2;
      // add interaction
      object.interactive = true;
      object.on('mouseover', function() {
        this.texture = allGraphics[Math.floor(Math.random()*allGraphics.length)];
    //falling flowers in different sizes
    var rand = Math.floor(Math.random()*allGraphics.length);
    fallingSprite = new PIXI.Sprite(allGraphics[rand]);
    fallingSprite.anchor.x = 0.5;
    fallingSprite.anchor.y = 0.5;
    fallingSprite.scale.x = fallingSprite.scale.y = 0.25;
    fallingSprite. y = input.height* 2;
    //for REVEAL in beginning
    var graphic;
    // Generate some sprites
    for (var i = 0; i < 100; i++) {
      // Create a new sprite
      graphic = new PIXI.Sprite(input.graphics.stone);
      // Set position randomly on the screen
      graphic.x = Math.random() * input.width;
      graphic.y = Math.random() * input.height;
      // Set rotation randomly
      graphic.rotation = Math.random() * 360;
      // Set center point of each object
      graphic.anchor.x = 0.5;
      graphic.anchor.y = 0.5;
      // Random scale from 0 to 50%
      graphic.scale.x = graphic.scale.y = 0.5 //Math.random() * 0.5    
      // Add sprite to the container (so we can see it)
      // Add sprite reference to the array variable

  render: function(PIXI, input) {
    //get rows to changes graphic when mouse moves over
    var changeGraphics;
    //input.mouseTouchPosition: function(PIXI, input);
    //REVEAL in beginning
    // We make a variable to save each element of the array
    if (input.currentTime < 3){
    var mySprite;
    var pos;
    var speed = 0.5
    // Loop half the sprites in the array to the right
    for (var i = 1; i <= spriteArray.length; i++) {
      // Get a reference of each sprite
      mySprite = spriteArray[i-1];
      // X position gets 20% of i added
      pos = i * speed + 5
      if (i>spriteArray.length/2){
        pos = -i * speed + 5
      mySprite.x += pos;
      // X position gets 1% of i added
      mySprite.rotation += i * 0.001;
    //falling according to the cast
    var thisCast = input.cast ;
      curCast = thisCast
      //if(thisCast.id == "all"){
      if(fallingSprite.y > input.height + fallingSprite.height){
        //console.log("falling flower")
        var rand = Math.floor(Math.random()*allGraphics.length);
        fallingSprite.texture = allGraphics[rand];
        fallingSprite.y = -fallingSprite.height;
        fallingSprite.x = Math.random() * input.width;
        fallingSprite.scale.x = fallingSprite.scale.y = 0.1 + Math.random() * 0.25;
    //how the flower is falling with a sinus curv
    fallingSprite.y += 3;
    fallingSprite.x += Math.sin(input.currentTime) * 2;
    fallingSprite.rotation += 0.01;

// Midground graphics (on top of band)
  at: "mid",
  init: function(PIXI,input){
    var sizeX = input.width
    var sizeY = input.height
    //opretter et billede, og bestemmer stoelse
    sprite = new PIXI.extras.TilingSprite(input.maskers.handdrawnanimal1, sizeX, sizeY)
    sprite.visible = false;
    //sprite.visible = false

  render: function(PIXI, input) {
  mouseDownTouchStart: function(PIXI, input){
    //if the mask is off, its not visable and we remove the mask as well
    if (maskActive) {
      maskActive = false;
      sprite.visible = false;
   //if the mask is on, it needs to be visable and we add the mask again
    } else {
      maskActive = true;
      sprite.visible = true;


🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................