Touch is the simplest and one of the most powerful forms of communication.
In this article, I will take a look into the possible future of CSS, the presentation layer of the web. I will be exploring touchable textures and how they could be applied in CSS to texture-enabled devices. By textures, I’m referring to the feeling of three dimensional surfaces like, smooth or bumpy, applied to a two dimensional surface of a device (or future 3D surfaces). Though this type of technology may not be readily available today, it’s certainly fun to imagine how texture styles may be implemented.
Experimental code ahead. The following code doesn't exist…yet.
My (rather crude) proposal is for a
texture property in CSS:
Of course, we would need to include our browser specific versions:
Possible `texture` properties (most ranging from 0 to 1, similar to `opacity`):
In shorthand, you'd only include the properties that are necessary (similar to `transform` values):
And store your custom `texture` for reuse (similar to @keyframes):
The `texture` values would have standard, pre-defined value names as strings the same way we already have color values like `cadetblue` and transition values like `ease-in-out`.
`detect` would choose the best texture based on the look of the element.
Browsers may handle these defaults differently, so I assume we could end up with vendor-prefixed values like `-webkit-smooth` as well.
The ability to build out the 3D surfaces of your textures would be possible through the use of technologies like `WebGL`*, `svg3d`, and possibly `matrix3d` (similar to how the CSS `transform` property works).
*Texture could be implemented with WebGL something like [this](//www.webdev20.pl/skins/default/js/demos/3d_grapher/webgl_ploter.html). [Credit goes to [Małgorzata Jatczyk](//plus.google.com/118328547579245186440/posts) for this awesome experiment].
texture to use
These textures may start off being implemented in a rather dull way at first or considered more novelty than practical, but over time devices would most assuredly be able to render complex 3D textures. Here are some ways developers could use textures.
Touchable textures would open up a whole new level of accessibility. Everyday smartphones and tablets could become much more powerful assistive devices.
We could bring Braille to mobile devices:
*`raised` would represent a two dimensional texture that is raised slightly off the page like an embossed business card.
Typing on your on-screen tablet keyboard:
Touchable textures in games would be pretty crazy.
Think about a game where the player rubs a metallic, somewhat adhesive surface until it reveals a smooth plastic texture that unveils a graphic or number, similar to how someone would scratch a lottery ticket to see if they'd won.
Or how riding on a sidewalk in a skateboarding game might be written:
You could engage on a deeper emotional level with your users through the textures of your buttons:
My examples are simple implementations of my proposed `texture` property. My hope is by this point you've thought of many new ways CSS textures could be used and maybe better ways it could be implemented.
The advancement of the web lies in our hands, but more importantly in our imagination.