2D Space
How do I make an 2d space?
What is a 2d space? How do you make a 2d space? This script and codes were developed by Josep Antoni Bover Comas on 27 August 2022, Saturday.
2D Space - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>2D Space</title>
</head>
<body> <!-- Simplified object for 2D and THREE.js canvas (designed for my web page banners and for doing tests with them) -->
<!-- Can work in 2 ways, normal / test mode, and banner mode (for my web page headers) -->
<script src='https://devildrey33.es/Ejemplos/Utils/ObjetoCanvas.js'></script>
<link rel='stylesheet' href='https://devildrey33.es/Ejemplos/Utils/ObjetoCanvas.css'></link> <script src="js/index.js"></script>
</body>
</html>
2D Space - Script Codes JS Codes
/* Banner que simula un espacio en 2d a alta velocidad, creado por Josep Anotni Bover Comas el 06/07/2013 para devildrey33.es */
var Banner_Espacio2D = function() { // Llamo al constructor del ObjetoCanvas if (ObjetoCanvas.call(this, { 'Tipo' : '2d', 'Ancho' : 'Auto', 'Alto' : 'Auto', 'Entorno' : 'Normal', 'MostrarFPS' : true, 'ElementoRaiz' : document.body }) === false) { return false; } // Arrays para cada plano this.Estrellas = []; this.TotalEstrellas = ((this.Ancho * this.Alto) / 250); // Creo el array de estrellas for (var i = 0; i < this.TotalEstrellas; i++) { var Vel = Rand(5) + 0.5; var Col = 199 + Math.floor(Vel * 10); this.Estrellas[i] = new this.Estrella(RandInt(this.Ancho), RandInt(this.Alto), Vel, "rgb("+ Col + "," + Col + "," + Col + ")"); } this.Cargando(false);
};
Banner_Espacio2D.prototype = Object.assign( Object.create(ObjetoCanvas.prototype) , { constructor : Banner_Espacio2D, // Datos de la animación [requerido] Nombre : "Espacio 2D", IdeaOriginal : "devildrey33", URL : "http://devildrey33.es/Blog/Canvas2D_1", NombreURL : "Tutorial HTML5 Canvas2D parte 1", // Función que se llama al redimensionar el documento Redimensionar : function() { }, // Función que se llama al hacer scroll en el documento Scroll : function() { }, // Función que pinta cada frame de la animación Pintar : function() { this.Context.fillStyle = 'rgba(49, 46, 53, 0.4)'; this.Context.fillRect(0, 0, this.Ancho, this.Alto); for (i = 0; i < this.TotalEstrellas; i++) { this.Estrellas[i].X -= this.Estrellas[i].Velocidad; // Se ha salido del recuadro if (this.Estrellas[i].X < 0) { var Vel = Rand(5) + 0.5; var Col = 199 + Math.floor(Vel * 10); this.Estrellas[i] = new this.Estrella(this.Ancho, RandInt(this.Alto), Vel, "rgb("+ Col + "," + Col + "," + Col + ")"); } this.Context.fillStyle = this.Estrellas[i].Color; this.Context.fillRect(this.Estrellas[i].X, this.Estrellas[i].Y, 1, 1); } }, Estrella : function(X, Y, Velocidad, Color) { this.X = X; this.Y = Y; this.Velocidad = Velocidad; this.Color = Color; }
});
var Canvas = null;
window.addEventListener('load', function() { Canvas = new Banner_Espacio2D; });
Developer | Josep Antoni Bover Comas |
Username | devildrey33 |
Uploaded | August 27, 2022 |
Rating | 3 |
Size | 2,506 Kb |
Views | 32,384 |
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 |
Hex Tunnel 0.5 | 4,865 Kb |
CSS Loader Cassette | 2,671 Kb |
ObjetoAnimacion | 3,303 Kb |
Simple geometry | 3,272 Kb |
Adiestramiento de cubos | 6,029 Kb |
CSS menu concept | 8,949 Kb |
3D Rgb Spyral | 4,142 Kb |
3D Audio Analyzer | 12,951 Kb |
ObjetoCanvas y ObjetoLogo | 7,884 Kb |
Hex Tunnel 1.0 | 5,494 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 |
Minimal Material Design Form Input | Koenigsegg1 | 3,076 Kb |
CSS- UI Element States Pseudo-Classes | Tesla809 | 2,206 Kb |
Dice | Fraina | 5,026 Kb |
A Pen by Miro Olma | Programiro | 2,342 Kb |
Countdown Timer | Massiebn | 3,001 Kb |
SVG email test v2.0 | M_J_Robbins | 2,090 Kb |
Velocity.js custom stagger | Tommiehansen | 4,805 Kb |
Personal Logo Animation | Lloydwheeler | 3,795 Kb |
Slider for stackoverflow | KKOKU | 3,222 Kb |
Wavy Road with Dashes | Jonobr1 | 2,679 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!