
BIT-101
Next page>>1 2 3 4 Last page
JavaScript Drag and Drop DOM Elements
Views: 499 16 Nov 2011 10:52 pm
File this under “really writing this for myself so I can refer back to it later.” window.onload = function() { var foo, offsetX, offsetY; // so it exists foo = document.createElement("div"); document.body.appendChild(foo); // so we can see it: foo.style.width = "100px"; foo.style.height = "100px"; foo.style.backgroundColor = "blue"; // so we can move it where we [...]
Kindle Fire First Impressions
Views: 490 16 Nov 2011 10:52 pm
I got my Kindle Fire last night and wanted to post some initial impressions of the device. First of all, I love it. Great form factor, feels very solidly built, great display, does all that I need it to do. I could not put it down for more than 2 seconds last night. Take that [...]
Recent Events and my non-reaction
Views: 451 14 Nov 2011 09:37 pm
I’ve been using Flash since 1999 or so. It’s responsible for my career and any small bit of fame and fortune I might have. Most of the people I count as friends have come from the Flash community. Flash will always be something more than just a technology to me. I think Flash has seen [...]
Sublime Text 2 HTML Template and Build System
Views: 502 11 Nov 2011 07:52 pm
I’ve been doing a lot of HTML/JS development lately. My editor of choice these days is Sublime Text 2. A really great editor with loads of features and nearly infinite customization ability. But, as I’m doing a lot of learning and experimenting, I’m finding the need to create a lot of small, throwaway projects to [...]
Design Tactics †Select Single
Views: 474 11 Nov 2011 07:52 pm
The other day I was coding a particular UI implementation and realized that I had coded the same thing in multiple languages multiple times. I knew exactly how I was going to go about it and did what I usually do and, as usual, it worked just right. I started wondering how many examples like [...]
MinimalCompsJS 0.1 Release
Views: 478 11 Nov 2011 07:52 pm
Well, it’s high time I got these out there so people can use them. See them in action: http://www.bit-101.com/MinimalCompsJS/release/0.1/ I’ve combined all the files into one and minified it so you only need to include a single file, plus jQuery. The html for the above example is simply: <!DOCTYPE html> <html> <head> <title>Page Title</title> <script [...]
MinimalCompsJS Preview #2
Views: 482 11 Nov 2011 07:52 pm
Just uploaded an update to the MinimalCompsJS project. The demo looks pretty much the same as the last one, but the components are completely refactored. Now, each component creates its own individual canvas element and adds it to a div (or any other element that can contain a canvas). So you don’t need to create [...]
MinimalCompsJS Preview
Views: 487 11 Nov 2011 07:52 pm
A while back, when I first started playing with HTML5 and Canvas, I considered the idea of making a port of MinimalComps. I immediately rejected the idea as silly. I mean, if you’re in HTML, you already have UI controls, right? But I mentioned it to a few people and tweeted about it, and I [...]
Linescapes Iteration 9
Views: 127 08 Sep 2011 07:04 pm
A different gety function: $(function() { var canvas, linescape, hills; canvas = $("#canvas").get(0); linescape = new LineScape(canvas); linescape.xres = 1; linescape.zres = 0.5; hills = []; for(var i = 0; i < 100; i += 1) { hills[i] = {x:Math.random() * 1000 - 500, z: Math.random() * 2000, force:Math.random() * 2000 + 1000}; } linescape.gety [...]
Linesc
Views: 367 08 Sep 2011 07:04 pm
Linescapes Iteration 8
Views: 123 06 Sep 2011 12:15 pm
Create a LineScape object in LineScape08.js: function LineScape(canvas) { this.context = canvas.getContext("2d"); this.width = canvas.width; this.height = canvas.height; this.xcenter = this.width / 2; this.ycenter = this.height / 2; this.zcenter = 500; this.z = 5000; this.fl = 350; this.xres = 2; this.zres = 2; this.context.fillStyle = "#ffffff"; this.draw = function() { var self = this; this.interval [...]
Linescapes Itera
Views: 398 06 Sep 2011 12:15 pm
Linescapes Iteration 7
Views: 133 05 Sep 2011 12:13 pm
Put back in a bit of randomness. A more interesting form. Draw progressively so screen doesn’t hang. $(function() { var canvas, context, width, height, x, x1, x2, y, z = 5000, fl = 350, xres = 2, zres = 2, xcenter, ycenter, zcenter, scale, interval; canvas = $("#canvas").get(0); context = canvas.getContext("2d"); width = canvas.width; height [...]
Linescapes Iteration 6
Views: 143 04 Sep 2011 11:58 am
Add a gety(x, z) function and a more interesting form. $(function() { var canvas, context, width, height, x, x1, x2, y, z = 5000, fl = 350, xres = 5, zres = 5, xcenter, ycenter, zcenter, scale; canvas = $("#canvas").get(0); context = canvas.getContext("2d"); width = canvas.width; height = canvas.height; xcenter = width / 2; ycenter [...]
Linescapes Iteration 5
Views: 150 03 Sep 2011 10:25 am
Move horizon out. Stretch to edge of canvas. Fade lines in distance. Add a fill to cover previous lines. $(function() { var canvas, context, width, height, x, x1, x2, y, z = 5000, fl = 350, xres = 5, zres = 5, xcenter, ycenter, scale; canvas = $("#canvas").get(0); context = canvas.getContext("2d"); width = canvas.width; height [...]
Linescapes Iteration 3
Views: 150 02 Sep 2011 09:45 am
Make it 3D. $(function() { var canvas, context, width, height, x1, x2, y, z = 600, fl = 350, xcenter, ycenter, scale; canvas = $("#canvas").get(0); context = canvas.getContext("2d"); width = canvas.width; height = canvas.height; xcenter = width / 2; ycenter = height / 2; while(z > 0) { scale = fl / (fl + z); [...]
Linescapes Iteration 2
Views: 130 01 Sep 2011 01:57 am
Draw a bunch of lines. $(function() { var canvas, context, width, height; canvas = $("#canvas").get(0); context = canvas.getContext("2d"); width = canvas.width; height = canvas.height; for(var y = 0; y < height; y += 10) { context.beginPath(); context.moveTo(0, y); context.lineTo(width, y); context.stroke(); } }); Result.
Beta Culture
Views: 93 01 Jul 2011 12:54 am
Technology has entered a phase where pretty much everything is a beta. Take GMail. The first beta appeared in 2004. It remained in beta status until 2009. In fact, people so missed the “BETA” label on the GMail logo that there’s an official Google extension that allows you to add it back in! Virtually all [...]
Syntax
Views: 136 15 Apr 2011 06:50 pm
Doing some Android dev these days. Needed to check if a editable text field was empty or not. I had to dig around to find out how to do this. It turns out that an EditText’s getText() method returns an instance of Editable. You need to convert this to a string and then call equals(“”) [...]
Lissajous Webs
Views: 153 07 Apr 2011 06:40 am
More JavaScript! I’ve actually started delving into Android, but I’m still tinkering with JS too. I’ve been fleshing out the Verlet System I created last month. Added some cool stuff to it. I’ll be doing a future post on that when I get a few more things added. But just recently I started redoing some [...]
|
Site Rank: 492296
Access speed: 47 Related sites: |
Total articles: 67 |