The Fish
How do I make an the fish?
A Simple fish following the mouse :). What is a the fish? How do you make a the fish? This script and codes were developed by Christian Östman on 11 September 2022, Sunday.
The Fish - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>The Fish</title>
</head>
<body> <canvas id="theCanvas" width="800" height="600" style="background-color:black"></canvas> <script src='http://cdnjs.cloudflare.com/ajax/libs/EaselJS/0.7.1/easeljs.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
The Fish - Script Codes JS Codes
var fish;
var water;
function init()
{ water = new createjs.Bitmap("http://pg.asmallgame.com/water.jpg") stage.addChild(water); fish = new createjs.Bitmap("http://pg.asmallgame.com/fish.png") fish.x = 100; fish.scaleX = -.3; fish.scaleY= .3; stage.addChild(fish);
}
function draw()
{ fish.x = fish.x + (mouse.x - fish.x) * .02; fish.y = fish.y + (mouse.y - fish.y) * .02; if(fish.x > mouse.x) fish.scaleX = 0.3; else fish.scaleX = -0.3;
}
var stage = new createjs.Stage(document.getElementById('theCanvas'));
var stageWidth = document.getElementById('theCanvas').width; var stageHeight = document.getElementById('theCanvas').height;
var main = new createjs.Shape();
stage.addChild(main);
graphics = main.graphics;
createjs.Ticker.setFPS(40);
createjs.Ticker.addEventListener("tick",update);
function update()
{ draw(); stage.update();
}
mouse = {x: 0, y: 0};
document.addEventListener('mousemove', function(e){ mouse.x = e.clientX || e.pageX; mouse.y = e.clientY || e.pageY
}, false);
init();
Developer | Christian Östman |
Username | chribbe |
Uploaded | September 11, 2022 |
Rating | 3 |
Size | 1,919 Kb |
Views | 34,408 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
A Small Island with sheep | 7,849 Kb |
Workshop Start | 1,517 Kb |
The pigs | 1,845 Kb |
Lounge Weather | 3,357 Kb |
Random 3D Landscape - camping trip | 4,805 Kb |
The Rope | 2,886 Kb |
Fire particles PIXI | 3,094 Kb |
Famo.us tilt-shift demo without Famo.us | 2,067 Kb |
The Rope with Youtubevideo | 3,242 Kb |
Water Ripples - HtmlGL | 1,945 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Side Sliding Menu CSS | EduardL | 4,388 Kb |
Wikipedia Viewer | Thalpha | 4,426 Kb |
Whyutils | LeYvan | 3,752 Kb |
Loading animation with css | Icebob | 2,947 Kb |
Countdown Timer | Massiebn | 3,001 Kb |
Bootstrap example | Ssaakkaa | 2,716 Kb |
Cool Page Split Effect | Anthonyadamski | 6,128 Kb |
Underlined form fields | Mitchdot | 2,323 Kb |
Dribbble Template | ExtremelyGinger | 2,204 Kb |
RSW | JordanC | 3,726 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!