반응형
반응형

Verlet-js — A JavaScript physics engine

Javascript/Added on May 15, 2013/Add to favorites

Verlet-js is a Verlet integration physics engine written in JavaScript and released under the MIT License. It can handle simulations, composites, particles, and constraints.

Verlet-js

Homepage: http://subprotocol.com/verlet-js/
GitHub: https://github.com/subprotocol/verlet-js

 

 

About

verlet-js a simple Verlet integration physics engine written in javascript by Sub Protocol. Verlet is pronounced 'ver-ley'.

Examples

  1. Shapes (Hello world)
  2. Fractal Trees
  3. Cloth
  4. Spiderweb

Features

The following is the entity hierarchy used within verlet-js:

  • Simulation: Root object that holds composite entities and drives all physics and animation within a scene.
  • Composites: A high level object used within the scene (ball, bridge, cloth, etc..)
  • Particles: Just a point in space that responds to gravity.
  • Constraints: Links particles together so they can interact with each other.
    1. Pin: Binds a particle to a static/fixes position in space.
    2. Distance: Binds two particles together by a fixed linear distance.
    3. Angle: Binds 3 particles to each other by an acute angle.

License

You may use verlet-js under the terms of the very permissive MIT License.

Source Code

View project on GitHub

 

 

반응형
반응형

7 CSS and JavaScript Performance Tips

 

http://webdesignledger.com/tips/7-css-and-javascript-performance-tips

 

Have you ever thought about how many customers you lose by having a slow site? And I’m not talking about file size only, as we rely on browser capacities to understand our code, we need to consider the processing time also.

That’s why sometimes adding a few bites in your code is much better because it save you precious seconds when real browsers or IE try to process your code.

Let’s see a few nice tips on how to improve this:

1. Don’t repeat yourself

You should use the cascade and avoid repeating code. It’s more than just using common classes, you could make good use of the heritance, for instance, so properties that can be set in the parent should be left there. Also you could use the same set of properties for multiple elements (separating multiple selectors using commas, you know).

Also, in your JS make good use of objects, functions and plugins so you don’t need to repeat code.

2. Write from right to left

Unlike us, browsers will process jQuery and CSS selectors from right to left. You may think that this won’t affect your code, but the truth is that it changes everything. A selector like this one is really, really bad:

$(“body #container div a”)

What we think we are writing is “Hey Browser, find the ‘body’ tag, and then inside of it find the #container. There you’ll find a ‘div’ and a couple of ‘a’ elements, let’s select those”. But the browser will actually read the entire page searching for ‘a’ tags, then for each tag it finds it’ll check if it has a div as parent, then check if the div has an element with the #container id, then
check if there’s a body tag beneath them.

7 CSS and JS performance tipsImage from Alex Anistratov

This is just too messy. In the JS we have some elegant solutions, like the find function so your code will actually be read as you wanted. Something like this would be good:

$(“#container”).find(“div”).find(“a”)

When you’re writing CSS you don’t have much options but leaving it as specific as possible, so try finding the closest class or ID you can find.

3. ID’s are really fast

Whenever possible use ID’s, they are faster either in CSS or JS. When using JS you have the possibility of using alternatives rather than jQuery to select tags, like document.body or even passing the entire DOM tree as an array (if you already know the exact location of the element).

4. Keep the selectors short

Keep in mind that sometimes an extra item in your selector will just mess up your code. For instance if you have a “ul li a” selector, you could simply use the “ul a” and you’ll be fine.

The best JS tip we can give you is “don’t use it”. Most times you simply don’t need it and using will cost you a lot more in performance, development time, browser compatibility and maintenance.

You can replace a lot of animations by CSS animations, and you could also use a library like yepnope or modernizr to conditionally load fallbacks for browsers that can’t keep up with your awesomeness.

6. You don’t need to declare your vars, but you should

A lot of people simply skip the var declaration step. That’s ok, but you’ll create a lot of global variables that can break other functionalities and also when the browser has to recover it, it’ll search from local to global scope.

Even if you’ll use a global scope var, you can redefine it locally so you’ll save some time. For example, instead of doing this:

var e1= document.getElementById('ID1'),
e2= document.getElementById('ID2');

Do this:

var doc= document,
e1= doc.getElementById('ID1'),
e2= doc.getElementById('ID2');

So you’ll locally store the document var

7. Do math like you do in your head

We tend to think that programming languages do some kind of black magic and give us the result of complex operations. But the truth is that every single operation has a processing cost. For example, instead of doing 2*15 it’s much easier to do 15+15.

The true tip in this case is, use the more native JS code as you can, so avoid relying on jQuery or other plugins because that will certainly take more time to load and often more code to write.

7 CSS and JS performance tipsImage from Kevin Andersson

BONUS: 8. Remove one image from your source code

The One Less JPG movement is right when they say that removing one image from your source code would save you far more bites than what you’d save by worrying about JS (and CSS). But the truth is: You should do both.

We should always do our best to improve user experience and if that means that an image will look good in the page, and the fancy JS animation has to be removed, so do it.

반응형
반응형

우드로 윌슨 미국 대통령은 ‘자기 자신의 두뇌뿐 아니라
빌려 쓸 수 있는 두뇌까지 모두 사용해야 한다’라고 말했다.
왜 두뇌만 빌리는가? 손도 마음도 모두 빌려라.
린든 존슨 대통령은 이 사실을 알고 있었다.
‘모두가 힘을 합쳐 해결하지 못할 문제는 없다.
그러나 혼자서 해결할 수 있는 일은 거의 없다.’
-존 맥스웰, ‘매일 읽는 맥스웰 리더십’에서

 

‘유능한 인재 뒤에는 다른 유능한 인재 여럿이 있다’는
중국 속담이 있습니다.
모든 것을 혼자하려고 하는 사람에겐
이미 게임은 끝난 것이나 다름없습니다.
뭔가 큰 일을 도모한다면
반드시 다른 사람들과 함께 해야 합니다.
위대한 일은 결코 혼자 힘으로는 이룰 수 없습니다.

반응형
반응형


그 주 금요일,
학교에서는 정기 미사가 있었다.
나는 하느님한테 부탁드릴 게 있었다.
"하느님. 제발, 제발 오줌을 싸지 않도록 해주세요.
하느님, 이건 제가 평소에 부탁드리는 문제들과는 달라요.
정말 제게는 중대한 문제예요. 아주 많은 일들이
거기 달려 있거든요. 제 소원을 들어주시고,
야뇨증을 고쳐주신다면 진심으로
감사드릴 거예요. 아멘."


- 콘스턴스 브리스코의《사랑받지 못한 어글리》중에서 -


* 오줌을 누는 일.
어떤 사람에게는 간절한 기도 제목입니다.
인공항문에 의존하는 어느 암환자는 "제대로
변을 보는 것이 소원"이라고 말했습니다.
대소변을 보는 일이 엄청난 복입니다.
살아 있는 지금의 모든 것이 너무도
감사할 일들인데 때때로
놓치며 살 뿐입니다.

 

반응형

'생활의 발견 > 아침편지' 카테고리의 다른 글

'100 퍼센트 내 책임'  (0) 2013.05.17
처음엔 걷지도 못했다  (0) 2013.05.16
꽃은 피고 지고, 또 피고 지고...  (0) 2013.05.14
콧노래  (0) 2013.05.13
좋은 인연  (0) 2013.05.11
반응형

산에서는 일기를 쓰고 바다에서는 편지를 써라. 산은 내면적인 수행의 장소이고, 바다는 이상향을 생각하는 세계로 가는 길목이다. - 고은 -

반응형
반응형

20 jQuery Plugins for Creative Web Typography

 

http://lava360.com/20-jquery-plugins-for-creative-web-typography/?utm_source=rss&utm_medium=rss&utm_campaign=20-jquery-plugins-for-creative-web-typography

 

jQuery has changed the world of internet and its website, now more responsive and beautiful websites are being designed by the designers using new technologies. jQuery has prominent capabilities to garnish website designs with flash like objects but with tiny code files in comparison of Flash files. On other hand typography plays very important role to distinguish a website among other websites over internet. Using different topographies for different purpose may lead to a unique and attractive web design, which is an ultimate goal of any designer’s life. One more advantage for using visually appealing typography to your web design is – it’s fruitful for webmaster analysis, everyone known textual matter is more important than of images. So without or less use of images would make your website design more SEO friendly.

To help you out, we have gathered 20 jQuery plugins to create web typography. With the help you these plugins you will be able to design attractive web typography for you web designs.

Type Butter

Type Butter

jMetronome

jMetronome

Kerning

Kerning

Airport

Airport

Baseline

Baseline

jQuery.exdent

jQuery-exdent

Arctext.js

Arctext

fontResizer

fontResizer

HatchShow

HatchShow

RV Font Size

RV Font Size

SlabText

SlabText

jQuery Text Zoom

jQuery Text Zoom

BigText

BigText

jSlabify

jSlabify

JQISOTEXT

JQISOTEXT

Textillate.js

Textillate

Textualizer

Textualizer

Responsive Measure

Responsive Measure

jQuery Text Resizer

jQuery Text Resizer

Line In Typography

Line In Typography

반응형

+ Recent posts