Tony Danza, left, and Joseph Gordon-Levitt in “Don Jon,” which marks Gordon-Levitt’s debut as a screenwriter and director. (Daniel McFadden/Relativity Media)

Joseph Gordon-Levitt has a mild obsession with patterns. He sees them everywhere. There are the necessary ones — the sun rises, the sun sets; we inhale, we exhale — and the helpful routines that give our days structure. But there are also detrimental patterns, and those are the kind that inspired Gordon-Levitt’s first foray into feature screenwriting and directing.

Don Jon” follows a modern-day Don Juan, played by Gordon-Levitt, who spends plenty of time picking up ladies at bars but much prefers the mindless and emotion-free pleasures of pornography. He might call it a habit, but it looks an awful lot like addiction. He’s a connoisseur of sorts. His Web browsing is perfectly regimented, consisting of a to-do list he checks off many times a week and sometimes multiple times a day. Even after he meets a “10” named Barbara (played by Scarlett Johansson) and strikes up a relationship, he can’t seem to escape the siren song of his laptop rebooting.

While “Don Jon” turns into a complex portrayal with a surprisingly sweet message, early chatter surrounding the movie focused mainly on the pornography element.

“I had the script and somebody said, ‘Oh, Joe Gordon-Levitt wrote this script and it’s about porn,’ and I was like, ‘Ugh, okay,’” recalled actress Julianne Moore. She plays the off-kilter and straight-talking Esther, who becomes Jon’s unlikely friend. “And I started reading it, and I looked up halfway through, and I said [to my husband], ‘This isn’t about porn. This is amazing.’ Really, it’s a movie about intimacy to me. I found it really surprising, really touching, very, very funny, very original and I was completely taken with it.”

In some ways, that disconnect between how the movie has been perceived and the true nature of the film couldn’t be more appropriate. While Jon does indeed have an addiction to pornography, his real problem is that he is a victim of artifice — he has fooled himself into believing the raunchy fantasy can be real, and true life can never live up. As his foil, Barbara, too, has it all wrong. A romantic-comedy aficionado, she believes that if a man truly loves a woman, he should give up everything to be with her, just like in the movies. Anything less isn’t worth her time.

“The first kernel of an idea was trying to get at a story of how people treat each other more like things than like people and how media can play into that,” Gordon-Levitt said on a recent visit to Washington. “I think it’s something everybody does to everybody else. We sort of have a tendency to pigeonhole each other.”

Some of these sentiments were no doubt inspired by Gordon-Levitt’s career path. He has worked in Hollywood most of his life and has denounced celebrity culture and the paparazzi’s compulsion to chase actors. And while he does come across as a typical 32-year-old guy, his easy, upbeat demeanor offers plenty of reminders of the cute kid from the 1990s sitcom “3rd Rock From the Sun.” He spent much of the interview sitting cross-legged in a chair, revealing his mismatched socks (one had sheep, the other cars — some patterns are meant to be broken) and Adidas sneakers. On hitRECord, a Web-based collaborative production company Gordon-Levitt founded, he goes by the name Regular Joe.

The character he wrote for himself is not quite so humble.

“I thought, well who’s Don Juan today? And the first guy I thought of was that guy, you know, dis guy,” Gordon-Levitt said, breaking into his character’s New Jersey accent, “with the gym body and the shiny hair, and it made me laugh.”

Another former child actor, Johansson was also drawn to some of the movies dominant themes, which was a relief for Gordon-Levitt, who always pictured her in the role of the deluded and somewhat domineering bombshell.

“I’ve always admired her work and skill and talent as an actress, whether it’s ‘Vicky Cristina Barcelona’ or ‘Lost in Translation’ or her hosting on ‘SNL’ really well, and I just always envisioned her as this character,” Gordon-Levitt said. “She’s a young woman who’s a very smart person, a very talented artist and yet, oftentimes, is reduced to just being good looking and I think she was keen to sort of satirize that aspect of our culture.”

The film was made on a shoestring budget in order for Gordon-Levitt to retain creative control, and the idea was to premiere the movie at Sundance in the hopes that a company would acquire distribution rights. It worked, and in the meantime, critics and movie-goers met the film with plenty of praise.

“A lot of people, whether journalists or just audiences, really love it and get everything we’re doing, and some people kind of dismiss it because it doesn’t pull its punches and it uses vocabulary — both verbal vocabulary as well as visual vocabulary — that some people won’t want to engage with, and that’s fine,” Gordon-Levitt said. “I was pretty confident that people my age would like it. I was curious whether people my parents’ age would like it, and [they] have really liked it a lot. So that’s something that’s been a pleasant surprise.”

Moore credits Gordon-Levitt’s success to both his vision and his assuredness. The actress, who has worked with Paul Thomas Anderson, Robert Altman and Alfonso Cuarón, puts Gordon-Levitt among her echelon of “really good” directors.

“He really knew what he wanted, he knew what tone he wanted to set, he knew what he needed to accomplish in a scene, but he was also willing to adjust something if he needed to. He had flexibility,” she said. “I’m not surprised that people are enjoying it. . . . It played so beautifully. I think it played the way it read, where it appears to be about one thing that’s kind of wildly, raucously funny and then there’s something mysterious and touching and surprising about it.”