A felicidade da cor
é o verdadeiro amor
Pen Settings
HTML
About HTML Preprocessors
HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
Adding Classes
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
About the <head>
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
Insecure Resource
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS
About CSS Preprocessors
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
CSS Base
About CSS Base
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
Vendor Prefixing
About Vendor Prefixing
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Add External Stylesheets/Pens
Any URLs 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 its URL and the proper URL extension.
About External Resources
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript
About JavaScript Preprocessors
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
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.
About External Resources
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
About Packages
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
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
CSS
JS
new Frame(FIT, 800, 800, black, black, ready);
function ready() {
// given F (Frame), S (Stage), W (width), H (height)
// put code here
// add the art to a container so we can chop it up into a puzzle!
const art = new Container(W,H).addTo();
new Rectangle(W,H,new GradientColor([pink,purple],90)).addTo(art);
new Rectangle(W,H,new GradientColor([blue,yellow])).addTo(art).ble("color-burn");
const circle = new Circle(H*.4,new RadialColor(["red","yellow".toAlpha(.9)])).center(art);
const rings = new Container(circle.width,circle.height);
loop(10, i=>{
new Circle(H*.4-i*32-11, clear, dark, 20).center(rings);
})
circle.effect(new AlphaEffect(rings)); // mask the circle with the alpha of the rings
loop(40, (i,t)=>{
new Squiggle({interactive:false}).reg(-30,TOP).sca(2).loc(W/2,H/2,art).rot(360*i/t).ble("color-burn");
});
new Circle(50,blue).center(art).ble("color-burn");
// made the art above and now remove it and turn it into a puzzle
art.removeFrom();
// prepare the cols and rows for the puzzle
// each time it will pick from the next item
// a plain series would keep repeating this order.
// a series with .shuffle() would randomize this order but keep repeating it
// a series with .random() would randomize the order after each completion
// a series with .mix() will randomize but make sure not to repeat the choice from the previously randomized series
// if we just put in arrays, ZIM VEE would pick the arrays in order
// but each time, pick randomly from the array to get a single number
// such is the powerful recursive effect of ZIM VEE.
// So we tell it not to pick randomly from the inner array but actually return the array.
const pieces = series(
{noPick:[2,2]},
{noPick:[3,3]},
{noPick:[3,4]},
{noPick:[2,10]},
{noPick:[4,4]},
{noPick:[8,4]},
{noPick:[1,20]}
)
.mix(); // comment out the mix to do in order
// each time the scrambler is solved we will make a new scrambler with a different chop
// and we will also run this once at the start
let scrambler;
function makePuzzle() {
if (scrambler) scrambler.dispose();
let p = pieces(); // get the next array in the series
scrambler = new Scrambler({
tile:chop(art,p[0],p[1]),
time:1.8, // total time for scrambling
num:4 // number of switches
}).center().bot(); // under Emitter
scrambler.on("complete", ()=>{
scrambler.noMouse();
emitter.spurt(24);
timeout(3, makePuzzle);
});
}
makePuzzle();
// make the reward emitter and start paused
const emitter = new Emitter({
obj:new Rectangle(300,300,clear,black,5),
force:{min:2, max:8},
shrink:false,
interval:.05,
life:2,
num:2,
gravity:0,
startPaused:true
}).center();
// Docs for items used:
// https://zimjs.com/docs.html?item=Frame
// https://zimjs.com/docs.html?item=Container
// https://zimjs.com/docs.html?item=Circle
// https://zimjs.com/docs.html?item=Rectangle
// https://zimjs.com/docs.html?item=Squiggle
// https://zimjs.com/docs.html?item=Scrambler
// https://zimjs.com/docs.html?item=noMouse
// https://zimjs.com/docs.html?item=effect
// https://zimjs.com/docs.html?item=loop
// https://zimjs.com/docs.html?item=loc
// https://zimjs.com/docs.html?item=bot
// https://zimjs.com/docs.html?item=ble
// https://zimjs.com/docs.html?item=rot
// https://zimjs.com/docs.html?item=reg
// https://zimjs.com/docs.html?item=sca
// https://zimjs.com/docs.html?item=addTo
// https://zimjs.com/docs.html?item=removeFrom
// https://zimjs.com/docs.html?item=center
// https://zimjs.com/docs.html?item=AlphaEffect
// https://zimjs.com/docs.html?item=Emitter
// https://zimjs.com/docs.html?item=shuffle
// https://zimjs.com/docs.html?item=timeout
// https://zimjs.com/docs.html?item=GradientColor
// https://zimjs.com/docs.html?item=RadialColor
// https://zimjs.com/docs.html?item=series
// https://zimjs.com/docs.html?item=toAlpha
}
Console
Editor Commands
Also see: Tab Triggers