Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Draw



  Cool HTML5 matrix effect

Do you still remember the movie The Matrix? Do you still remember the cool matrix effect in that movie? How is that effect achieved? Shaun Dunne shared a piece of HTML5 code which displays a cool matrix effect. The matrix demo can be found here. Below is the code which he achieves this effect: with var s = window.screen; var width = q.width = s.width; var height = q.height = s.height; var letters = Array(256).join(1).split(''); var draw = function () { q.getContext('2d').fillStyle='rgba(0,0,...

   Matrix,HTML5     2013-08-14 08:03:34

  Javascript motion tracking

It is very often that I have to do video motion tracking for interactive video campaign in my daily work. If I’m used used to do that in Flash, I made a quick experiment to do the same in javascript. Thanks to Olof Storm who made me a perfect corner pin motion tracking in After Effects, and I’ve been using some code from Steven Wittens to draw an image in perspective. Click here to see the motion tracking demo (give it a bit of time to fully load). What I’m doing in this dem...

   JavaScript,Motion tracking,Flash     2012-03-20 07:43:46

  How to make contribution to GitHub correctly?

If you have a GitHub account, then you will be able to see a section called Public contributions on your profile page. Your contribution status for the past year will be showed on this section, it's called contribution calendar. This calendar has 7 rows and 53 columns. Each cell on the grid represents your contribution status for one day, if the contribution is different, the cell color will be different. There are 5 colors in total : white, yellow, light green,green and deep green. With this, s...

   GitHub,Contribution calendar,Public contributions     2013-09-27 10:47:11

  Simple Animation in the HTML5 Canvas Element

HTML5 is generating all kinds of buzz these days. Some of the buzz is about HTML5 being a replacement for Adobe’s Flash. I don’t think it’s there yet but it’s certainly on the way to changing the way content is presented on the web. This is a description of a very simple animation in an HTML5 canvas element. It is coded for readability and not for optimized operation. We’ll add a canvas element to a web page and then use javascript to draw on it. We will...

   HTML5,Canvas,Animation,Sample code     2011-07-01 10:20:08

  The tic-tac-toe game with Python

In this tutorial, we will show how to build a tic-tac-toe game with Python. We will use functions,arrays,if statements,while statements, for loops and error handling etc. First, we need to create two functions, the first function will display the borad of the game: def print_board(): for i in range(0,3): for j in range(0,3): print map[2-i][j], if j != 2: print "|", print "" Here we used two for loops to loop through the map, this map is...

   Python,Tic-Tac-Toe     2013-07-30 02:49:09

  What we still can’t do client-side

With the rise of all these APIs and the browser race to implement them, you’d think that currently we can do pretty much everything in JavaScript and even if we currently can’t due to browser support issues, we will once the specs are implemented. Unfortunately, that’s not true. There are still things we can’t do, and there’s no specification to address them at the time of this writing and no way to do them with the APIs we already have (or if there is a ...

   Chanllenge,Client side,Server side     2012-01-10 07:22:31

  When and Where to Use Pointers in Go

When declaring variables in Go, we usually have two syntax options: In some scenarios, pointers; in others, reference; sometimes, either. It’s great to have choices, but it is also confusing sometimes as to which one in which scenario. To be more reasonable in choice-making, I started from pointers, walked through their natures, and summarized some rules in using them in Go. from unsplash, Jordan Ladikos Pointers Go has pointers. A pointer holds the memory address of a ...

   POINTER,GOLANG     2022-05-01 02:24:43

  How to draw pentagram in HTML5 canvas

I wrote simple function to this magical symbol I like so much: 123456789101112131415161718192021222324252627282930<!doctype html><html><body>    <canvas id="c" width="500" height="500"></canvas>    <script> var ctx = (document.getElementById("c")).getContext("2d"); // draws rotated pentagram with or without cirlefunction pentagram( ctx, x, y, radius, rotate, circle ){    ctx.beginPath();&nbs...

   Html 5,Canvas,pentagram     2012-04-23 12:56:06

  What’s the waiter doing with the computer screen?

When Richard Gatarski and a few friends wanted to dine in the Swedish city of Norrköping a few weeks ago, they booked a table at a downtown Italian restaurant that seemed nice. When they arrived, they were greeted by the headwaiter, who asked if they had a reservation. Richard confirmed, and the headwaiter looked at his computer screen. ”Gatarski? Hm, let’s see .. yes, there’s your reservation. Welcome!” The headwaiter then picked up what Richard first thought m...

   Waiter,Computer screen,Touch     2012-03-12 11:07:01

  Save QWidget as image

Qt library is an excellent GUI library for C++ programmers developed by Nokia and now is an open source project. Often, we may use QPainter to draw strings, lines or images on a QWidget. We can override the QWidget's paintEvent() method when we want to use QPianter object to draw something on a QWidget. If we want to save the items drawn on QWidget as image for later reference, what can we do? We can save a QWidget as an image. Here is the code for achieving this: QPixmap pixmap(this->size())...

   Qt,C++,QWidget,Image     2012-08-19 12:01:18