javascript控制台

您的指南 (YOUR GUIDE TO)

Welcome readers from ◎ Your Guide to Coding Creativity on the Canvas

欢迎◎ 《画布编码创意指南》的读者

We are using the ZIM JavaScript Canvas Framework which is easily to use and get started with! Find out more with ◎ Your Guide to Selecting a JavaScript Canvas Library or Framework.

我们正在使用ZIM JavaScript Canvas框架,该框架易于使用和入门! ◎了解更多信息◎ 选择JavaScript画布库或框架指南 。

Controls operate on existing objects. We have discussed page and layout controls in ◎ Your Guide to Responsive and Adaptive design on the Canvas and accessibility controls in ◎ Your Guide to Accessibility on the Canvas with JavaScript.

控制对现有对象进行操作。 我们已经在◎ 画布上的自适应和自适应设计指南中讨论了页面和布局控件,并且在◎ 您JavaScript画布上可访问性指南中讨论了页面和布局控件。

We will now look at the rest of the main controls in ZIM:

现在,我们将看看ZIM中的其他主要控件:

  • MOTIONCONTROLLER

    运动控制器

    move objects with mouse, key and gamepad

    使用鼠标,键和游戏板移动对象

  • EMITTER

    发射器

    emit objects as particles

    发射物体为颗粒

  • PEN

    钢笔

    dynamically draw

    动态绘制

  • PARALLAX

    百乐

    move objects with a 3D effect

    以3D效果移动对象

  • SCROLLER, DYNAMO AND ACCELERATOR

    滚动,动态和加速器

    animate backgrounds and Sprites

    动画背景和精灵

  • VR AND PORTAL

    VR和门户

    3D for side-by-side viewers and jumps

    并排观看者和跳跃的3D

  • SYNTH AND SOUNDWAVE

    合成和声波

    make sound and animate to sound

    发出声音并发出声音

  • SWIPER AND 3D

    滑动器和3D

    move or rotate an object in 3D

    以3D方式移动或旋转对象

  • PHYSICS

    物理

    make a world with forces, collisions and more!

    用力量,碰撞和更多来创造一个世界!

运动控制器 (MOTION CONTROLLER)

A MotionController() will control whatever DisplayObject you pass to its first parameter. Let’s code together with this handy Online Editor. You are one click and copy away from coding! Type or copy and press TEST:

一个 MotionController()将控制一切的DisplayObject传递给它的第一个参数。 让我们与这个方便的Online Editor一起编码。 您只需单击一下即可复制编码! 输入或复制并按TEST:

const car = new Rectangle(120,60).centerReg();new MotionController(car);

Press anywhere to make the car slide (we will fix that soon) to that location.

按任意位置可使汽车滑行(我们将尽快修复)到该位置。

Car slides to where you press with MotionController
汽车滑到使用MotionController按下的位置

The MotionController has many parameters. See the ZIM Docs. There are bounds, rotate, flip, firstPerson, speed, and more.

MotionController有许多参数。 请参阅ZIM文档 。 有范围,旋转,翻转,firstPerson,速度等等。

The second parameter is the type of input. Here are the options:

第二个参数是输入的类型。 以下是选项:

  • mousemove

    鼠标移动

    target follows mouse movement

    目标跟随鼠标移动

  • pressmove

    按动

    target jumps to mouse then follows while pressing

    目标跳到鼠标,然后在按下时跟随

  • pressdragtarget follows mouse if pressed on and then dragged

    如果按下目标键,则dragd目标跟随鼠标移动,然后拖动

  • keydownkeys control the target (see map parameter)

    KEYDOWN键控制目标(见地图参数)

  • gamebuttongamepad buttons control the target

    gamebutton游戏手柄按钮控制目标

  • gamestickgamepad stick(s) control the target

    游戏手柄手柄杆(一个或多个)控制目标

  • swipeswipe to control the target

    滑动滑动以控制目标

  • followmousedown and hold and use Frame.follow()

    跟随 mousedown并按住并使用Frame.follow()

  • manualset a custom input and use convert(), x and y

    手动设置自定义输入并使用convert(),x和y

// make a better car!STYLE = {corner:10};const car = new Rectangle(120,60).centerReg();new Rectangle(50,50,yellow).center(car);new MotionController({    target:car,    type:"mousemove",    rotate:true});

Here is the ZIM MotionController demo page where you control a butterfly sprite with mouse, keys or game controller on the canvas!

这是ZIM MotionController演示页面,您可以在画布上使用鼠标,键或游戏控制器来控制蝴蝶精灵!

ZIM MotionController demo pageZIM MotionController演示页面

As with the rest of the controls, this could be coded manually but it is the type of code that is used in many games, puzzles, apps, etc. — we call them Zapps. So we code them once and provide them as controls. Let’s see some more controls!

与其他控件一样,可以手动进行编码,但这是许多游戏,拼图,应用程序等中使用的代码类型-我们将其称为Zapps。 因此,我们将它们编码一次并提供它们作为控件。 让我们看看更多控件!

发射器 (EMITTER)

With the Emitter(), we emit a bunch of copies of whatever DisplayObject we pass to its first parameter. There are parameters to handle the interval (how fast), life (how long), force, gravity, wind, properties can we animate, etc. See the ZIM docs.

瓦特 i个投光器(),我们发出了一堆什么的DisplayObject我们传递给它的第一个参数的副本。 有一些参数可以处理间隔(多长时间),寿命(多长时间),力,重力,风,我们可以设置动画的属性等。请参见ZIM文档 。

CLEAR and then type or copy this and TEST:

清除,然后键入或复制此内容并进行测试:

new Emitter( new Poly(200,6,.6,yellow,dark) ).center();

Let’s see what we can do with a few parameter changes. We can use the ZIM VEE values on the Poly to make each star different. We will also switch to ZIM DUO for the parameters. See ◎ Your Guide to Conveniences when Coding on the Canvas to learn about ZIM VEE and ZIM DUO.

让我们看看我们可以通过一些参数更改来做什么。 我们可以在多边形上使用ZIM VEE值来使每颗星星都不同。 我们还将切换到ZIM ​​DUO作为参数。 请参阅◎ 在画布 编码时的便利指南, 以了解ZIM VEE和ZIM DUO。

new Emitter({    obj:new Poly({        radius:{min:50, max:100},        sides:[5,6,7],        pointSize:{min:.5, max:.8},        color:[yellow, orange, red],        borderColor:dark    })}).center();

And now, let’s play with the Emitter parameters:

现在,让我们使用Emitter参数:

new Emitter({    obj:new Poly({        radius:{min:50, max:100},        sides:[5,6,7],        pointSize:{min:.5, max:.8},        color:[yellow, orange, red],        borderColor:dark    }),    interval:.8,    num:30,    force:{min:4, max:8},    life:2,    angle:{min:-90-20, max:-90+20},    animation:{        props:{rotation:[360,-360]},        time:{min:1, max:3},        loop:true    }}).center();
A short animated gif of Emitter on canvas :: the actual zapp looks better!
画布上Emitter的简短动画gif ::实际的zapp看起来更好!

钢笔 (PEN)

The ZIM Pen() will help you draw. We made a complex app called GenPen to explore possibilities. Wow! How exciting.

吨他ZIM Pen()将帮助你画。 我们制作了一个名为GenPen的复杂应用程序来探索可能性。 哇! 多么激动人心。

GenPen app made with ZIM PenGenPen应用程序的结果

Let’s make a drawing app in a couple of lines. CLEAR, type and TEST:

让我们用几行代码制作一个绘图应用程序。 清除,类型和测试:

new MotionController({  target:new Pen().addTo(),  type:"pressdrag"});

The default MotionController speed is 10 so it takes the pen a while to catch the mouse. Let’s set the speed to 100. Another setting to consider is damping. Damping is how quickly an object moves to its target and can be used to make smoother motion. Damping is being applied to the MotionController and the Pen. We will turn damping off on the MotionController with damp:1 and leave the damping at the default for the Pen.

默认的MotionController速度为10,因此笔需要一段时间才能抓住鼠标。 让我们将速度设置为100。要考虑的另一个设置是damping阻尼是物体移动到其目标的速度,可以用来使运动更平滑。 阻尼将应用于MotionController和Pen。 我们将使用Motion:1在MotionController上关闭阻尼,并将Pen的阻尼设置为默认值。

Let’s add a black Rectangle to the background. Normally, this is done with the color parameter of the Frame, but here we are in an editor that adds the stripes at the back.

让我们在背景中添加黑色矩形。 通常,这是通过Frame的color参数完成的,但是在这里,我们在编辑器中,在后面添加了条纹。

WARNING: a MotionController will by default, not be activated with a press on another object. This allows the user to properly press interface like buttons without the controlled object moving to the button. On any background objects you want to activate the MotionController either add them to mousedownIncludes or call their noMouse() method.

警告:默认情况下,将不会通过按下另一个对象来激活MotionController。 这允许用户在不将受控对象移动到按钮的情况下正确按下按钮之类的界面。 在要激活MotionController的任何背景对象上,可以将它们添加到mousedownIncludes或调用其noMouse()方法。

const rect = new Rectangle(stageW, stageH).addTo();new MotionController({  target:new Pen({      penType:"kitetail",      size:{min:10, max:80}  }).addTo(),  type:"pressmove",  speed:100,  damp:1,  mousedownIncludes:rect});

百乐 (PARALLAX)

Parallax is when things move at different speeds to give a sensation of depth. Usually, things in the background move slower than things in the foreground. Try looking far away. Now, hold your hand in front of you and shift your head left and right. Your hand appears to move more (faster) than the background.

P arallax是事物以不同的速度运动以产生深度感的时候。 通常,背景中的事物移动速度比前景中的事物慢。 尝试远看。 现在,握住您的手,然后左右移动头部。 您的手似乎比背景移动得更多(更快)。

CodePen showing Parallax on the Canvas
CodePen在画布上显示视差

With ZIM Parallax() existing DisplayObjects are added to layer objects along with which property to change and how much to adjust. The input for the change can also be set. This defaults to mouseX but can be mouseY, scrollX, scrollY or a custom input. You then pass the layer objects to Parallax() in an array as the first parameter. Alternatively, the add() method can be used to add them individually.

使用ZIM Parallax()现有的DisplayObjects以及更改的属性和调整的量将添加到图层对象。 也可以设置更改的输入。 默认为mouseX,但可以为mouseY,scrollX,scrollY或自定义输入。 然后,将图层对象作为第一个参数传递给数组中的Parallax()。 或者,可以使用add()方法单独添加它们。

CLEAR your code, copy and paste this and press TEST:

清除代码,复制并粘贴,然后按TEST:

// make assets to move around// these could be pictures, shapes, containers, etc.const back = new Rectangle(800, 200, yellow).center();const mid = new Rectangle(400, 200, green).center().mov(0,30);const front = new Circle(80, red).center().mov(0,60);// make Parallax object// here we move with mouseX and mouseYconst parallax = new Parallax([   {obj:back, prop:"x", propChange:50},    {obj:back, prop:"y", propChange:40, input:"mouseY"},   {obj:mid, prop:"x", propChange:125},    {obj:mid, prop:"y", propChange:80, input:"mouseY"},   {obj:front, prop:"x", propChange:200},    {obj:front, prop:"y", propChange:100, input:"mouseY"}]);
Code in Five Minutes with ZIM :: parallax example on the canvas
画布上具有ZIM ::视差的五分钟代码示例

There is also page scroll parallax. Here are some examples:- http://danzen.com/holiday2015/- https://zimjs.com/parallax.html- https://codepen.io/danzen/pen/ExPXNOx- https://zimjs.com/bits/view/parallax2.html

还有页面滚动视差。 以下是一些示例: -http : //danzen.com/holiday2015/-https : //zimjs.com/parallax.html-https : //codepen.io/danzen/pen/ExPXNOx-https : //zimjs.com /bits/view/parallax2.html

ZIM Bits Parallax using the ZIM Window as opposed to Browser windowZIM位视差

滚动,动态和加速器 (SCROLLER, DYNAMO AND ACCELERATOR)

The ZIM Scroller() takes a DisplayObject and animates it horizontally or vertically as a repeating background. Here is a simple example:

吨他ZIM Scroller()需要一个DisplayObject和水平或垂直动画它作为一个重复的背景。 这是一个简单的示例:

Pen showing Scroller and Sprite on Canvas
笔在画布上显示Scroller和Sprite

In the above example, the Sprite and the Scroller are running at one speed. We have put a system in place with a Dynamo and Accelerator to allow the user to change the speed.

在上面的示例中,Sprite和Scroller以一种速度运行。 我们已经安装了带有DynamoAccelerator的系统,以允许用户更改速度。

A Dynamo() lets you set a percentSpeed on a Sprite so you can speed it up and slow it down. An Accelerator() lets you collect Dynamo and Scroller objects to set their percentSpeed together. Pass the accelerator to a MotionController() and the user can speed up and slow down the whole scene. This is pretty amazing!! Move your cursor (or press your finger) to the left and right in this example :

Dynamo()允许您在Sprite上设置一个percentSpeed,以便可以加快和降低速度。 Accelerator()允许您收集Dynamo和Scroller对象以一起设置它们的percentSpeed。 将加速器传递给MotionController() ,用户可以加快和减慢整个场景。 这真是太神奇了! 在此示例中,左右移动光标(或按手指):

Pen showing Scroller, Sprite with Dynamo, Accelerator and MotionController
显示Scroller,带有Dynamo的Sprite,加速器和MotionController的笔
// create an accelerator which will move all things proportionally// use a Dynamo to allow the Sprite to have a dynamic speed!// can use more backgrounds and foregrounds to do parallaxconst accelerator = new Accelerator([    new Scroller({backing:background, speed:1.5}),     new Dynamo({sprite:spaceGuy, reversible:false})]);new MotionController({    target:accelerator,     type:"mousemove",    axis:"horizontal",    speed:100,    minPercentSpeed:-250,    maxPercentSpeed:250});

Pop on over to YouTube to watch us code a dynamic sprite scene in Five minutes! Well, we cheated in this one with two five minute episodes!

跳至YouTube,在五分钟内观看我们为动态Sprite场景编写代码! 好吧,我们在这个作弊游戏中有两集,每集五分钟!

FIVE MINUTES SPRITE SCENEFIVE MINUTES DYNAMIC SPRITE SCENE

五分钟动感现场 五分钟动感现场

Five Minute Sprite Scene and 五分钟精灵场景和Five Minute Dynamic Sprite Scene五分钟动态精灵场景

VR和门户 (VR AND PORTAL)

Here are a couple controls you do not see often! ZIM VR() will copy a scene to an adjacent scene and add depth shifting so they look 3D when viewed with a side-by-side viewer like Google Cardboard or Samsung Gear. Dr Abstract loved the 3D effect example… use a viewer!

^ h ERE有一对夫妇控制你不经常看到! ZIM VR()会将场景复制到相邻场景并添加深度平移,因此当使用并排查看器(如Google Cardboard或Samsung Gear)查看时,它们看起来为3D。 Abstract博士喜欢3D效果示例 …使用查看器!

ZIM VR promo site showing depth shifted Display ObjectsZIM VR促销网站显示了深度偏移的显示对象
ZIM VR promo site showing popular phone VR viewer for $20ZIM VR促销网站以20美元的价格显示了受欢迎的手机VR查看器
ZIM VR demo site with spectacular scroll parallaxZIM VR演示站点,具有壮观的滚动视差
// prepare content inside one containerconst content = new Container(stageW/2, stageH);// this background tile has no depth or is at "screen" depth// there will be no depth shift and no parallaxnew Tile(new Rectangle(10,10,light), 20, 1, 10)  .center(content);// these rectangles are given depth using the dep() method// the rectangles will be shifted in the x by VR// centerReg the objects for proper parallaxvar box = new Rectangle(50,50,green)  .centerReg(content)  .dep(10);new Rectangle(70,70,clear,blue,5)  .centerReg(content)  .dep(12);// 1. this just shows content in 3D with no motion:const vr = new VR(content).addTo(stage);// 2. this will move when the head is turned (device is rotated) // but with no parallax:const vr = new VR(content, 160, 400).center();// 3. this shows parallax when the head is turned// but with no positional movement:const vr = new VR(content, 0, 400, 2, 60).center();// 4. this shows motion and parallax as the head is turned:const vr = new VR(content, 160, 400, 2, 60).center();

ZIM VR Docs example with depth shifting, parallax, head tracking and warning indicatorsZIM VR Docs示例
Bubbling YouTube video on ZIM VR上播放YouTube视频

The second effect in this section is ZIM Portal() which was a fun little experiment to go from one place to another (or page to another). Try out the ZIM Portal Demo Page.

本节的第二个效果是ZIM Portal() ,这是一个有趣的小实验,可以从一个地方转到另一个地方(或从页面移到另一个地方)。 试用ZIM门户演示页面 。

ZIM Portal demo page to travel from place to place on rolloverZIM Portal演示页面可在翻转时从一个地方移动到另一个地方
// portalObject is the object to act like a portal// lands is a Container that holds DisplayObjects// such as pictures or interactive scenesvar portal = new Portal(portalObject, lands);

合成和声波 (SYNTH AND SOUNDWAVE)

ZIM Synth() lets you play a sound recorded by an online tool or play tones that you can manipulate. ZIM SoundWave() lets you capture sound frequencies so you can animate to sound! Both wrap the HTML 5 WebAudio API. The ZIM Synth Demo Page is an example with both controls in the same app with the SoundWave in the middle circle. There is also a ZIM SynthPad example where you can multitouch different sounds.

Z IM Synth()允许您播放在线工具录制的声音或播放可以操纵的音调。 ZIM SoundWave()使您可以捕获声音频率,以便为声音设置动画! 两者都包装HTML 5 WebAudio API。 ZIM合成器演示页面是一个示例,其中两个控件在同一应用中,中间是SoundWave。 还有一个ZIM SynthPad示例,您可以在其中多点触摸不同的声音。

ZIM Synth demo page with Synth and SoundWaveZIM Synth演示页面

Let’s code a Synth together in our Online Editor. CLEAR, type or copy and TEST the following to hear a tone:

让我们在在线编辑器中一起编写Synth的代码。 清除,键入或复制以下内容并进行测试以听到提示音:

// apps must be interacted with before playing soundconst synth = new Synth();new Button({label:"PLAY", corner:0})  .sca(2)  .center()  .tap(playTone);function playTone() {  synth.tone();}

Change the tone() to add some WAH to a Square wave:

更改tone()以向方波添加一些WAH:

function playTone() {  synth.tone({      shape:SQUARE,       wahRate:2  });}

Here are Bubbling and Explore videos that take you through all sorts of options for the ZIM Synth and the ZIM Docs entry for Synth. There are also some examples of the Synth play() method in the ZIM Sounds example.

以下是冒泡和浏览视频,这些视频带您进入ZIM Synth的各种选项以及Synth的ZIM Docs条目。 ZIM Sounds示例中也有Synth play()方法的一些示例。

ZIM SoundWave() lets you animate to sound frequencies from songs, ZIM Synth or a microphone. See the ZIM Docs on SoundWave including links to the classic animated sound frequency bars.

ZIM SoundWave()使您可以为歌曲,ZIM Synth或麦克风的声音频率设置动画。 请参阅SoundWave上的ZIM文档 ,包括指向经典动画声频条的链接。

Animated light show with ZIM SoundWave动画动画表演
Code in Five Minutes with ZIM on SoundWave!用ZIM在五分钟内编码 !

In the Code in Five Minutes SoundWave video we collect data for 40 frequencies. When the SoundWave is ready we make 40 concentric circles with random colors. In a Ticker we call the calculate() method and set the radius of the circles based on the data at the frequencies!

在《五分钟编码的 SoundWave》视频中,我们收集了40个频率的数据。 当SoundWave准备就绪时,我们将制作40个具有随机颜色的同心圆。 在股票行情指示器中,我们调用calculate()方法并根据频率上的数据设置圆的半径!

To see how to load sound see ◎ Your Guide to Images, Sounds and Sprites on the Canvas. To see how we made the colors see ◎ Your Guide to Conveniences when Coding on the Canvas.

要了解如何加载声音,请参见◎ 画布上的图像,声音和精灵指南 。 要了解我们如何制作颜色,请参见◎ 您在画布上编码时的便利指南 。

const soundWave = new SoundWave(40, sound);soundWave.on("ready", () => {    const circles = new Container();    const colors = [pink, blue, green, orange, yellow];    loop(soundWave.num, ()=>{        new Circle(100, colors).addTo(circles);    });    circles.center();

    Ticker.add(() => {        let data = soundWave.calculate();        circles.loop((circle, i) => {            circle.radius = data[i];        });    });});

滑动器和3D (SWIPER AND 3D)

ZIM is a 2D canvas framework but we can bring in and control Threejs. When we do, the ZIM Swiper() is handy for rotating objects. Here is a CodePen example:

Z IM是2D canvas框架,但我们可以引入并控制Threejs。 当我们这样做时,ZIM Swiper()对于旋转对象非常方便。 这是一个CodePen示例:

Swiping a 3D model in ZIM and ThreeJS with the Swiper
使用Swiper滑动ZIM和ThreeJS中的3D模型

In the Pen above we play around with the model so it gets a touch complicated. The Swiper part is easy. We make a Rectangle under the 3D object called swiperRect. We adjust the rotation about the x axis just a little so that we can tilt the phone back. In the example, we also rotate the phone around the y axis and change the pictures every time the front is hidden!

在上方的笔中,我们使用该模型,以便使模型变得复杂。 滑动部分很容易。 我们在名为swiperRect的3D对象下创建一个Rectangle。 我们只调整了绕x轴的旋转角度,以使手机向后倾斜。 在此示例中,我们还围绕y轴旋转了手机,并在每次隐藏前面板时更改图片!

// ZIM Swiper for controlling the rotation of the model// swipeOn, target, property, sensitivity, // horizontal, min, max, damp (using default)

new Swiper(swiperRect, phone.rotation, "x", .001, false, -.2, 0);
ZIM with Threejs and Swiper on Planet model
ZIM与Threejs和Swiper在行星模型上
ZIM Bits with ZIM and Threejs (no Swiper)ZIM位 (无刷卡器)

物理 (PHYSICS)

Physics sets up a world with bodies, forces, collisions and more! We use the Box2D Physics engine that powered Angry Birds. BUT… we made it way more simple in ZIM! We even teach physics to kids.

P hysics建立了一个拥有身体,力量,碰撞等等的世界! 我们使用为《愤怒的小鸟》提供动力的Box2D Physics引擎。 但是……我们在ZIM中使它变得更加简单! 我们甚至向孩子们教授物理 。

ZIM Kids physics example — try it!ZIM Kids物理示例 -试试吧!

We are about to add a Physics option to ZIM Kids Slate but for now we can pop over to ZIM Zoo which is a fun place to quickly try out ZIM code. Type this into the Zoo Editor and press VIEW. You will be amazed to find that you can throw around a ball in ZIM and have it bounce off the sides!

我们将为ZIM Kids Slate添加一个Physics选项,但现在我们可以跳至ZIM Zoo ,这是一个快速尝试ZIM代码的好地方。 将此输入到Zoo Editor中 ,然后按VIEW。 您会惊奇地发现您可以在ZIM中投掷一个球并使其从侧面反弹!

// NOTE that we CHECKED the physics checkbox above the editorconst physics = new Physics();new Circle()    .center()    .cur()    .addPhysics({bounciness:.7});physics.drag();
ZIM Zoo Editor :: check the Physics Checkbox and try it out!ZIM Zoo Editor ::检查Physics Checkbox并尝试一下!

There are all sorts of wonderful things you can do with physics. We have worked in many interactive environments, and this is by far the easiest we have ever had physics. As a matter of fact this makes a falling circle:

物理学可以为您完成各种奇妙的事情。 我们已经在许多交互式环境中工作,而这是迄今为止我们所学过的最简单的物理方法。 事实上,这圈出一个圈:

new Circle().center().addPhysics()

新的Circle()。center()。addPhysics()

Here is the ZIM TEN Physics Mini-Site announcing integrated physics and providing examples to guide balls, score goals, part love-beads, count soccer kick-ups and play a following game in cyberspace!

这是ZIM TEN Physics Mini-Site,它宣布了集成物理学,并提供了一些示例来指导球,得分目标,分割爱珠,计数足球踢球以及在网络空间中玩以下游戏!

ZIM TEN Physics MiniSiteZIM TEN Physics MiniSite

TIPS for Physics on the Canvas with ZIM:

使用ZIM的“画布物理技巧 ”:

  • Physics can have gravity (side view) with falling things物理可能会因物体坠落而产生重力(侧视图)
  • Physics can have no gravity (top view) like a pool game物理不能像台球游戏那样具有重力(俯视图)
  • There are static and dynamic bodies有静态和动态物体
  • Use a force to move things, not x and y animations用力移动物体,而不是x和y动画
  • Use the Physics drag(), not the ZIM drag()使用物理drag(),而不是ZIM drag()
  • Use the Physics contact(), not the ZIM hit tests使用物理contact(),而不是ZIM命中测试
  • You can join() things in different ways您可以通过不同的方式加入()事物
  • You can make the Physics world follow an object您可以使“物理世界”跟随一个对象

This example uses physics to make a cool data visualization:

此示例使用物理学进行了很酷的数据可视化:

Pen showing data visualization with physics in ZIM on the Canvas
笔在Canvas上以ZIM显示物理数据可视化

Here are some more Examples with comments in the code (view source):

以下是一些在代码中带有注释的示例(查看源代码):

PINBALL LIKE SPARKLESANTI-GRAV DEVICEHAND-DRAWN MAZEAPPLE FALLING FROM TREEPOLYGON PENKEEP NOODLE’S HAIR ON!WRESTLING RING

PINBALL LIKE火花反重力装置 手绘迷宫 APPLE坠落将TREE POLYGON PEN KEEP面馆头发! 摔角环

Physics can have buoyancy as shown in the famous ZIM Soup!

物理可以具有浮力,如著名的ZIM汤所示 !

ZIM Soup :: physics example with buoyancyZIM Soup ::具有浮力的物理示例

结论 (CONCLUSION)

Scroll up and down the page. We hope that you are inspired to code creativity on the canvas! Many of these topics are considered advanced, yet for the most part, they can be coded in a few lines each in ZIM. This allows you to concentrate on your creativity! What are you going to make? What assets will you use and how will you tell your story?

小号克罗尔上下页。 我们希望您受到启发,可以在画布上编写代码! 其中许多主题被认为是高级的,但在大多数情况下,它们可以在ZIM中以几行代码进行编码。 这使您可以专注于自己的创造力! 你要做什么? 您将使用什么资产以及如何讲故事?

There is plenty of coding left to do to make art, games, puzzles and apps. We very much look forward to seeing what you make. When you get coding with ZIM, please join us on our Slack Channel. Invite others to code with you. Tell colleagues, friends and family. These controls are nothing short of magical, and there is plenty of magic to go around.

还有许多代码可以制作艺术品,游戏,拼图和应用。 我们非常期待看到您的作品。 当您使用ZIM进行编码时,请加入我们的Slack Channel 。 邀请其他人与您一起编码。 告诉同事,朋友和家人。 这些控件具有神奇的功能,并且有很多魔术可以使用。

进一步阅读 (Further reading)

This guide is the last of the guides referred to in ◎ Your Guide to Coding Creativity on the Canvas.

本指南是《 您的画布上的编码创意指南》中提到的最后指南 。

The guides have roughly followed the ZIM Skool topics which also relate to the Learn JavaScript with Creative Coding video series. In each of these there is one added lesson. Data. We plan on a future guide about data as well as a future guide on creativity. Until then, for data, there is the added LESSON 09. For creativity, there is the Creativity Framework.

这些指南大致遵循了ZIM Skool主题,该主题还与“ 学习带创意编码JavaScript”视频系列有关。 在每个课程中,都有一个补充的课程。 数据。 我们计划着关于数据的未来指南以及关于创造力的未来指南。 在此之前,对于数据,添加了LESSON 09 。 对于创造力,有创造力框架 。

All the best! Dr Abstract.

祝一切顺利! 抽象博士。

Follow us on Twitter at ZIM Learn and here is ZIM Learn on YouTube!

在Twitter上的ZIM Learn上关注我们,这是YouTube上的ZIM Learn !

翻译自: https://medium.com/@zim_67337/controlling-the-canvas-with-javascript-d94792aa33cd

javascript控制台


http://www.taodudu.cc/news/show-5208298.html

相关文章:

  • 有哪些你看了以后大呼过瘾的数据分析书?
  • python用于数据分析的书籍_做数据分析不得不看的书有哪些?
  • 做数据分析不得不看的书有哪些?(文末抽奖送书)
  • 数据指标体系:什么是好的数据指标?
  • Visual Paradigm敏捷开发教程(13):如何创建燃烬图
  • 表现工作量完成程度的两种Excel图形表达(燃尽图、趋势图)-附模板
  • 团队任务2-1
  • Beta冲刺(3/7)——2019.5.24
  • java项目管理系统禅道下载,禅道项目管理软件
  • 极品飞车ol 与服务器连接不稳定,极品飞车ONLINE燃擎封测常见问题FAQ
  • 工具系列之Redmine插件与工作效率
  • grab最新安卓版 打车_Grab官方海外最新版下载-Grab安卓版打车软件下载 - 燃文下载站...
  • android 7.0下载地址,安卓7.0系统手机下载安装教程 Android7.0下载地址
  • android 7下载地址,Android7.0下载地址 安卓7.0系统手机下载安装教程
  • github更新,发布地址,燃尽图,总结
  • 5 分钟掌握燃尽图(上)
  • 项目管理必备——使用燃尽图监控项目整体进度
  • 敏捷实战:IT 事业部某项目燃尽图分析
  • 敏捷开发进度管理之燃尽图
  • R语言 | 常用统计量 基本函数 常规操作
  • 概率统计中的样本矩和顺序统计量
  • 算法设计与分析——顺序统计量:期望为线性时间的选择算法
  • 【统计学】第六章
  • keil仿真和使用示波器调波形
  • 驭电之道-用示波器测量电阻的伏安特性曲线 模电实验 示波器 波形
  • 示波器波形参数测量和FFT分析
  • 【老生谈算法】matlab实现仿真示波器波形——示波器仿真
  • 江苏DNS
  • 机器人暮色枪骑皮肤_那些年我们用过的机器人的Q技能,枪骑高调,它还是玩家们的最爱...
  • [C#.Net]全局钩子实现USB扫码枪无焦点状态下扫入

javascript控制台_使用JavaScript控制画布相关推荐

  1. javascript控制台_如何使用JavaScript控制台改善工作流程

    javascript控制台 by Riccardo Canella 里卡多·卡内拉(Riccardo Canella) 如何使用JavaScript控制台改善工作流程 (How you can imp ...

  2. javascript控制台_如何充分利用JavaScript控制台

    javascript控制台 by Darryl Pargeter 达里尔·帕格特(Darryl Pargeter) 如何充分利用JavaScript控制台 (How to get the most o ...

  3. javascript控制台_如何使您JavaScript控制台静音

    javascript控制台 by Shakeel Mohamed Shakeel Mohamed着 如何使您JavaScript控制台静音 (How to silence your JavaScrip ...

  4. javascript控制台_超越控制台日志3种在javascript中格式化控制台输出的方法

    javascript控制台 As JavaScript developers, we intuitively use console.log() to debug, print out variabl ...

  5. javascript 模板_了解JavaScript中的模板文字

    javascript 模板 The author selected the COVID-19 Relief Fund to receive a donation as part of the Writ ...

  6. javascript 注入_注入JavaScript牟利:如何检测和阻止撇取者

    javascript 注入 In 2019 British Airways was fined a remarkable £183 million for a data breach of its s ...

  7. javascript教程_最好JavaScript教程

    javascript教程 JavaScript is the most widely used scripting language on Earth. And it has the largest ...

  8. javascript 框架_克服JavaScript框架疲劳

    javascript 框架 by Tero Parviainen 通过Tero Parviainen 克服JavaScript框架疲劳 (Overcoming JavaScript Framework ...

  9. javascript原型_使用JavaScript的示例报告卡Web应用程序原型

    javascript原型 Hi! At times, beginners always find it hard getting the application of the theory they ...

最新文章

  1. 1.试述大数据对思维方式的重要影响。 2.详细阐述大数据、云计算、物联网之间的区别与联系。 3.简述你对大数据应用与发展的看法,以及你在这次大数据浪潮中想扮演什么角色。...
  2. IT职场人生系列之二十二:如何学习新语言(二)
  3. 脑电分析系列[MNE-Python-12]| 注释连续数据
  4. linux 性能测试 antutu,除了安兔兔跑分,还有这6种办法能证明手机强弱
  5. 耦合层:撮合物联网的理论与实践牵手的“月老”
  6. AD教程系列 | 2-认识其他电子元器件的封装
  7. CentOS7安装python3.6.6(解决所有安装异常情况!!!)
  8. 微波暗室——天线方向图测试
  9. Django验证码——手机注册登录
  10. 关于聊天室文字聊天(ListView 显示数据变化后滚动到最底部 )
  11. 黑白格子图案与苏格兰裙的关系
  12. 慎用cv::fitLine
  13. 如何利用计算机窃取信息,震惊部 · 用非接触的方式,窃取一台电脑上的信息...
  14. 关于参加“兆易创新杯”第十三届中国研究生电子设计竞赛,国赛二等奖的总结(fishing_5)
  15. 高德地图只显示部分区域
  16. PHP常用的文件操作函数集锦
  17. Android一周时间早中晚排班表
  18. Solr--Solr与Spring整合(非完整版)
  19. SWI-Prolog特性
  20. 垃圾邮件分类(trec06c数据集)特征分词、特征向量化、模型训练

热门文章

  1. java版本结巴分词算法bug
  2. Pedestrian Attribute Recognition
  3. mysql练习题-燕十八老师
  4. Tesseract训练字库研究过程中的一些问题和解决方案
  5. 正态分布(高斯分布)、均匀分布
  6. c语言图标电脑版,中国国家基本地形图查询软件
  7. Web前端学习笔记15:Web前端开发:jQuery总结
  8. 使用PCA分析鸢尾花数据
  9. OpenJudge 2456 Aggressive cows
  10. 系列学习 SpringBoot + Activiti7 工作流之第 3 篇 —— 【进阶篇】流程实例、个人任务