Übersicht: Blend4Web


Not everyone knows the Berlin clock and know how they "tick"! Blend4Web has a nice solution to show description of objects. We want to show in this station, how it works and use a script to automate the settings.


  1. Take an working example from the "Berlin Clock" tutorials.
  2. Create a new script for generating explanations.
  3. Review the result in the Fast Preview.
  4. Export the scene as a json file.
  5. Add the necessary HTML elements and scripts in a HTML page.
  6. Save all the necessary files in a test folder.
  7. Start a Web server and check the result.

Create labels is described in the manual. If the commands once performed and actions copied from the Info Window to a script, it is easy to add labels with information and it is reduced therefore to a few clicks!

Here is the script:

blend4web/labels/ (Source)

#! bpy
Name: ''
Blender: 27x
Group: 'Example'
Tooltip: 'Labelcreator--Blend4Web-Berlin-Clock'
import bpy

def create_labels():
    "Create and compose labels for the berlin-clock"

    clock_labels = [["seconds",
                     "Blinking every two seconds"],
                     "One element = five hours"],
                     "One element = one hour"],
                     "One element = five min./all 15 min. an other color"],
                     "Minutes", "One element = one minute"]]

    scn = bpy.context.scene
    for row in clock_labels:
        cube =[row[0]]
        coords = cube.location

        obj = bpy.context.object = row[0]+"_label"
        obj.b4w_object_tags.title = row[1]
        obj.b4w_object_tags.description = row[2]
        obj.b4w_enable_object_tags = True
        obj.b4w_enable_anchor = True

if __name__ == '__main__':
    scn = bpy.context.scene
    for ob in scn.objects:
        if ob.type == 'EMPTY':



The steps 3 to 6 correspond to the steps of the previous learning station and are not repeated here.

Hint: Clicked on the label, to view the explanation, possibly the rotation must be stopped beforehand.
Remark: The clock turns, but the time still stands still!