Javascript code that calculates how much active time is spent on a tab and takes into account changing tabs, switching windows, or leaving the page.
Demo here http://bl.ocks.org/d/4393523/
// 請下載空白作業 4 檔開始。 | |
PImage[] flames = new PImage[5]; | |
int[] flameFrameCount = new int[5]; // 這個火焰經過幾次系統影格了 -> 被 draw 了幾次 -> 便可透過 frameRate 來轉換成畫了幾秒。 | |
int[] flameX = new int[5] ; | |
int[] flameY = new int[5] ; | |
int boomIndex = 0 ; // 現在要用哪一來儲存爆炸狀態 -> 同時也代表,我要去用 array 的第幾格存。 | |
int yourFrameRate ; |
Javascript code that calculates how much active time is spent on a tab and takes into account changing tabs, switching windows, or leaving the page.
Demo here http://bl.ocks.org/d/4393523/
宣告一個裝 int 的 array ,有 5 格
格子依序填進 1 ~ 5
把每一個格子都 + 1
class Car {
// property
float speed ;
// Construct Method
Car (int initSpeed){
speed = initSpeed ;
練習:用暴力的方式,找出最小值
解答:
/** | |
* Minim-emulation code by Daniel Hodgin | |
*/ | |
// wrap the P5 Minim sound library classes | |
function Minim() { | |
this.loadFile = function (str) { | |
return new AudioPlayer(str); | |
} | |
} |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<meta name="description" content=""> | |
<meta name="author" content=""> |
/* | |
Copyright 2011 Martin Hawksey | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
Forked from Zachary Skalko's Pen HTML 5 Microphone Visualizer.