Media

CODE PAGE

Example Button Component

ZIM has a set of components that are found in Display module in the DOCS.

Components are often used for interface - like Buttons, Dials, Sliders, Windows, etc. You capture Events on the components - most often, a change event but in the case of a Button - we can use a mousedown or click.

// Put this in a template - see https://zimjs.com/code.html

// SAMPLE BUTTONS

const button = new Button(200,60,"SAMPLE") // normal parameters
    .center()
    .mov(-150);

button.on("click", ()=>{
    button.mov(-50);
    S.update(); // S is the stage
});

const button2 = new Button({ // ZIM DUO parameters
    corner:0,
    backgroundColor:pink,
    rollBackgroundColor:blue
})
    .center()
    .mov(150)
	.tap(()=>{
	    button2.mov(50);
	    S.update();
	});

Making digital environments in which people cancreate, communicate and play